update
This commit is contained in:
parent
56d83d2e9b
commit
3a33d083d7
118
dr1p1m4g3.py
118
dr1p1m4g3.py
@ -1,10 +1,10 @@
|
|||||||
####################################################################################################################################### SOF
|
####################################################################################################################################### SOF
|
||||||
|
import curses
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from curses import (A_REVERSE, KEY_DOWN, KEY_ENTER, KEY_LEFT, KEY_RIGHT,
|
from curses import (A_REVERSE, KEY_DOWN, KEY_ENTER, KEY_LEFT, KEY_RIGHT,
|
||||||
KEY_UP, ascii, wrapper)
|
KEY_UP, ascii, wrapper)
|
||||||
import curses
|
|
||||||
from imghdr import what as is_file_an_image
|
from imghdr import what as is_file_an_image
|
||||||
from os import chdir, listdir, path
|
from os import chdir, listdir, path
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -16,6 +16,66 @@ from tkinter.filedialog import askopenfile
|
|||||||
|
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
|
|
||||||
|
SHOWHELP=True
|
||||||
|
|
||||||
|
MOTD=[0,1]
|
||||||
|
MOTD[0]=f"""hotkeys:
|
||||||
|
m: shuffle on/off
|
||||||
|
p: autopump on/off
|
||||||
|
r: cycle image-rendering modes
|
||||||
|
t: display text on/off
|
||||||
|
up: increase autopump inverval
|
||||||
|
down: decrease autopump interval
|
||||||
|
left: change image
|
||||||
|
right: change image
|
||||||
|
s: move image to _keep direcotry
|
||||||
|
d: move image to _drop directory
|
||||||
|
q: quit program
|
||||||
|
|
||||||
|
Change SHOWHELP=True to SHOWHELP=False to remove this message.
|
||||||
|
"""
|
||||||
|
MOTD[1]=f"""base_picture_directory:
|
||||||
|
??: the directory you want to load images from
|
||||||
|
string: path
|
||||||
|
e.g. /home/user/Pictures
|
||||||
|
|
||||||
|
starting_index:
|
||||||
|
??: index number you want to start from
|
||||||
|
integer: index
|
||||||
|
e.g. 3
|
||||||
|
|
||||||
|
rendering mode:
|
||||||
|
??: the rendering mode you want to use to start
|
||||||
|
integer: index
|
||||||
|
0: image y screen-constrained - scales the image to the height of the screen
|
||||||
|
1: image x screen-constrained - scales the image to the width of the screen
|
||||||
|
2: image x,y screen-constrained - scales the image to the height,width of the screen
|
||||||
|
3: image x,y image-thumbnail - scales image within screen-resolution
|
||||||
|
4: image original - displays image at normal scale
|
||||||
|
e.g. 3
|
||||||
|
|
||||||
|
pump_mode:
|
||||||
|
??: this changes images automatically
|
||||||
|
integer: boolean
|
||||||
|
0: off
|
||||||
|
1: on
|
||||||
|
e.g. 1
|
||||||
|
|
||||||
|
pump_interval:
|
||||||
|
??: the interval in seconds between pictures changing automatically
|
||||||
|
float: value
|
||||||
|
e.g. 3.5
|
||||||
|
|
||||||
|
shuffle:
|
||||||
|
??: randomize order that images are loaded
|
||||||
|
integer: boolean
|
||||||
|
e.g. 1
|
||||||
|
|
||||||
|
Change SHOWHELP=True to SHOWHELP=False to remove this message.
|
||||||
|
|
||||||
|
command line:
|
||||||
|
usage: {sys.argv[0]} base_picture_directory_path starting_index rendering_mode pump_mode pump_interval shuffle
|
||||||
|
"""
|
||||||
|
|
||||||
###########################################################################################################################################
|
###########################################################################################################################################
|
||||||
class DR1P1M4G3():
|
class DR1P1M4G3():
|
||||||
@ -332,30 +392,31 @@ def main(screen):
|
|||||||
curses.init_pair(4,3,0)
|
curses.init_pair(4,3,0)
|
||||||
|
|
||||||
ch, first, selected, paths = 0, 0, 0, [ x for x in listdir() if os.path.isdir(x) ]
|
ch, first, selected, paths = 0, 0, 0, [ x for x in listdir() if os.path.isdir(x) ]
|
||||||
|
|
||||||
screen.erase()
|
screen.erase()
|
||||||
try:
|
|
||||||
screen.addstr(0,0,'SELECT A BASE DIRECTORY',curses.color_pair(2))
|
|
||||||
screen.addstr(': ',curses.color_pair(1))
|
|
||||||
screen.addstr('<< ',curses.color_pair(4))
|
|
||||||
screen.addstr('LEFT',curses.color_pair(3))
|
|
||||||
screen.addstr('/',curses.color_pair(1))
|
|
||||||
screen.addstr('RIGHT',curses.color_pair(3))
|
|
||||||
screen.addstr('/',curses.color_pair(1))
|
|
||||||
screen.addstr('ENTER',curses.color_pair(3))
|
|
||||||
screen.addstr(' >>',curses.color_pair(4))
|
|
||||||
screen.addstr(1,0,'[ ',curses.color_pair(1))
|
|
||||||
screen.addstr("THE CURRENT DIRECTORY",curses.color_pair(2))
|
|
||||||
screen.addstr(': ',curses.color_pair(1))
|
|
||||||
screen.addstr(f"{os.getcwd()}",curses.color_pair(3))
|
|
||||||
screen.addstr(' ]',curses.color_pair(1))
|
|
||||||
screen.addstr(2,0,'',curses.color_pair(1))
|
|
||||||
|
|
||||||
except Exception as e:
|
if SHOWHELP:
|
||||||
pass
|
try:
|
||||||
|
screen.addstr(0,0,'SELECT A BASE DIRECTORY',curses.color_pair(2))
|
||||||
|
screen.addstr(': ',curses.color_pair(1))
|
||||||
|
screen.addstr('<< ',curses.color_pair(4))
|
||||||
|
screen.addstr('LEFT',curses.color_pair(3))
|
||||||
|
screen.addstr('/',curses.color_pair(1))
|
||||||
|
screen.addstr('RIGHT',curses.color_pair(3))
|
||||||
|
screen.addstr('/',curses.color_pair(1))
|
||||||
|
screen.addstr('ENTER',curses.color_pair(3))
|
||||||
|
screen.addstr(' >>',curses.color_pair(4))
|
||||||
|
screen.addstr(1,0,'[ ',curses.color_pair(1))
|
||||||
|
screen.addstr("THE CURRENT DIRECTORY",curses.color_pair(2))
|
||||||
|
screen.addstr(': ',curses.color_pair(1))
|
||||||
|
screen.addstr(f"{os.getcwd()}",curses.color_pair(3))
|
||||||
|
screen.addstr(' ]',curses.color_pair(1))
|
||||||
|
screen.addstr(2,0,'',curses.color_pair(1))
|
||||||
|
screen.addstr(3,0,'Change SHOWHELP=True to SHOWHELP=False to remove this message.',curses.color_pair(3))
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
screen.refresh()
|
screen.refresh()
|
||||||
sleep(3)
|
sleep(6)
|
||||||
|
|
||||||
while ch != ascii.ESC:
|
while ch != ascii.ESC:
|
||||||
height, _ = screen.getmaxyx()
|
height, _ = screen.getmaxyx()
|
||||||
@ -387,12 +448,17 @@ def main(screen):
|
|||||||
###########################################################################################################################################
|
###########################################################################################################################################
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
#########################################################################################################################################
|
#########################################################################################################################################
|
||||||
|
if SHOWHELP:
|
||||||
|
print(MOTD[0])
|
||||||
|
print('press enter key to continue')
|
||||||
|
input()
|
||||||
|
print(MOTD[1])
|
||||||
|
print('press enter key to continue')
|
||||||
|
input()
|
||||||
#########################################################################################################################################
|
#########################################################################################################################################
|
||||||
DEBUG=True
|
DEBUG=False
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
USERPATH=str(wrapper(main))
|
USERPATH=str(wrapper(main))
|
||||||
|
|
||||||
IMGINDEX=int(0)
|
IMGINDEX=int(0)
|
||||||
RENDMODE=int(0)
|
RENDMODE=int(0)
|
||||||
PUMPMODE=int(1)
|
PUMPMODE=int(1)
|
||||||
@ -417,7 +483,7 @@ if __name__=="__main__":
|
|||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
try:
|
try:
|
||||||
IMGINDEX=int(sys.argv[2])
|
IMGINDEX=int(sys.argv[2])
|
||||||
print(f'[ specified user inded: {IMGINDEX} ]')
|
print(f'[ specified user index: {IMGINDEX} ]')
|
||||||
except:
|
except:
|
||||||
IMGINDEX=0
|
IMGINDEX=0
|
||||||
print(f'[ no image index was specificed: defaulting to 0 ]')
|
print(f'[ no image index was specificed: defaulting to 0 ]')
|
||||||
|
Loading…
Reference in New Issue
Block a user