FIX: Version 1.03

main
Kamal Curi 4 years ago
parent 8d7efc59e9
commit 4037b601aa

1
.gitignore vendored

@ -4,3 +4,4 @@ pasfile.csv
poptest.sh poptest.sh
what.sh what.sh
.pasfile.csv .pasfile.csv
pasfile.csv.gpg

@ -31,3 +31,7 @@
· Fixed 'help command' bug · Fixed 'help command' bug
· Fixed 'password modify' bug · Fixed 'password modify' bug
· Fixed bug with window resizing · Fixed bug with window resizing
- 1.03
· Added --no-symkey-cache to gpg, you will now have to type your password everytime you open Steelbox
· Major bug fixes:
Fixed resising terminal bug, and made data handling logic work.

@ -38,8 +38,7 @@ curses.cbreak()
stdscr.keypad(True) stdscr.keypad(True)
stdscr.clear() stdscr.clear()
def steelbox(): def init():
reloadFiles()
# Initializes the main window # Initializes the main window
global mainwin global mainwin
mainwin = curses.newwin(TERM_LINES -1, TERM_COLS, 0, 0) mainwin = curses.newwin(TERM_LINES -1, TERM_COLS, 0, 0)
@ -53,6 +52,13 @@ def steelbox():
statuswin.border() statuswin.border()
cleanWins() cleanWins()
# Main function
def steelbox():
reloadFiles()
init()
while True: while True:
termGlobals() termGlobals()
reloadFiles() reloadFiles()
@ -60,6 +66,46 @@ def steelbox():
stdscr.move(0, 0) stdscr.move(0, 0)
command() command()
# Displays the items on the screen properly
def displayItems():
cleanWins()
global NROWS
global ITEM_CURSOR
# Creates a name list
global displayList
displayList = []
# Appends the names in the CSV to display on the main window
for ps_name in files:
displayList.append(ps_name['service'][:15])
# Reset global necessities
LINE = 0
COLUMN = 0
currItem = 0
NROWS = 0
global highOpt
highOpt = ()
# Defines what to display
startDisplay = (CURR_PAGE-1)*MAX_ITEMS
stopDisplay = CURR_PAGE*MAX_ITEMS
for item in displayList[startDisplay:stopDisplay]:
# If the item is the one with the cursor, highlight it
if currItem == ITEM_CURSOR:
mode = curses.A_REVERSE
highOpt = mainwin.getyx()
else:
mode = curses.A_NORMAL
mainwin.addstr(1 + LINE, 1 + COLUMN, item, mode)
LINE+=1
currItem+=1
if LINE >= WINLIMIT:
LINE = 0
COLUMN+=16
NROWS+=1
STATUS_MESSAGE = "(n)ew,(d|el),(c)opy,(m)odify,(h)elp,(q)uit"
displayStatus(STATUS_MESSAGE)
mainwin.refresh()
# Defines global variables # Defines global variables
def globals(): def globals():
@ -190,6 +236,14 @@ def command():
rwin() rwin()
elif c == ord('h'): elif c == ord('h'):
sbhelp() sbhelp()
# This avoids the program crashing when resizing the terminal
elif c == curses.KEY_RESIZE:
y, x = stdscr.getmaxyx()
stdscr.clear()
curses.resize_term(y, x)
cleanWins()
globals()
init()
def newFile(): def newFile():
@ -371,6 +425,7 @@ def copy():
# Cleans the windows # Cleans the windows
def cleanWins(): def cleanWins():
stdscr.clear()
mainwin.clear() mainwin.clear()
statuswin.clear() statuswin.clear()
mainwin.border() mainwin.border()
@ -379,50 +434,6 @@ def cleanWins():
mainwin.refresh() mainwin.refresh()
statuswin.refresh() statuswin.refresh()
# Displays the items on the screen properly
def displayItems():
cleanWins()
global NROWS
global ITEM_CURSOR
# Creates a name list
global displayList
displayList = []
# Appends the names in the CSV to display on the main window
for ps_name in files:
displayList.append(ps_name['service'][:15])
# Reset global necessities
LINE = 0
COLUMN = 0
currItem = 0
NROWS = 0
global highOpt
highOpt = ()
# Defines what to display
startDisplay = (CURR_PAGE-1)*MAX_ITEMS
stopDisplay = CURR_PAGE*MAX_ITEMS
for item in displayList[startDisplay:stopDisplay]:
# If the item is the one with the cursor, highlight it
if currItem == ITEM_CURSOR:
mode = curses.A_REVERSE
highOpt = mainwin.getyx()
else:
mode = curses.A_NORMAL
mainwin.addstr(1 + LINE, 1 + COLUMN, item, mode)
LINE+=1
currItem+=1
if LINE >= WINLIMIT:
LINE = 0
COLUMN+=16
NROWS+=1
STATUS_MESSAGE = "(n)ew,(d|el),(c)opy,(m)odify,(h)elp,(q)uit"
displayStatus(STATUS_MESSAGE)
mainwin.refresh()
# Displays on the status window # Displays on the status window
def displayStatus(msg): def displayStatus(msg):
statuswin.border() statuswin.border()

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
version="1.02" version="1.03"
echo Steelbox V$version echo Steelbox V$version
@ -23,7 +23,7 @@ fi
python3 /opt/steelbox.py $version python3 /opt/steelbox.py $version
gpg -c --cipher-algo AES256 $HOME/.pasfile.csv gpg -c --no-symkey-cache --cipher-algo AES256 $HOME/.pasfile.csv
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then

Loading…
Cancel
Save