@ -15,6 +15,23 @@ class PassUi(wx.Frame):
The wx . Frame for passui
"""
def redraw ( * args ) :
""" Decorator used for redrawing the widgets in the sizer
Returns :
function : The decorated function
"""
func = args [ 0 ]
def wrapper ( self , * wrapper_args ) :
""" The wrapper function for the decorator
"""
self . sizer . Clear ( delete_windows = True )
func ( self , * wrapper_args )
self . sizer . Layout ( )
return wrapper
def __init__ ( self , * args , * * kw ) :
""" __init__.
@ -31,9 +48,9 @@ class PassUi(wx.Frame):
self . pnl . SetSizer ( self . sizer )
self . add_buttons ( )
@redraw
def add_buttons ( self ) :
""" add_buttons. """
self . sizer . Clear ( delete_windows = True )
self . add_tools ( )
if self . pass_handler . cur_dir != self . pass_handler . top_dir :
btn = self . make_back_button ( )
@ -63,7 +80,6 @@ class PassUi(wx.Frame):
btn )
index = index + 1
self . pnl . SetupScrolling ( )
self . sizer . Layout ( )
def add_push_pull ( self ) :
""" add_push_pull. """
@ -182,14 +198,14 @@ class PassUi(wx.Frame):
password + = text . GetLineText ( lineno )
password + = ' \n '
self . pass_handler . save_to_pass ( password , path , fullpath )
self . pass_handler . save_to_pass ( password , path , fullpath )
self . back_button_clicked ( )
@redraw
def show_new_dialog ( self ) :
""" show_new_dialog.
"""
self . sizer . Clear ( delete_windows = True )
passpath = self . pass_handler . cur_dir . replace ( self . pass_handler . top_dir , ' ' )
btn = self . make_back_button ( )
self . sizer . Add ( btn , 0 , wx . EXPAND ) # pylint: disable=no-member
@ -216,15 +232,14 @@ class PassUi(wx.Frame):
save_to_pass ( path , mtext , mname ) ,
sbtn )
self . pnl . SetupScrolling ( )
self . sizer . Layout ( )
name . SetFocus ( )
@redraw
def show_password_dialog ( self , index ) :
""" show_password_dialog.
: param index :
"""
self . sizer . Clear ( delete_windows = True )
self . add_tools ( index )
passpath = self . pass_handler . get_pass_path_from_index ( index , " password " )
@ -256,14 +271,13 @@ class PassUi(wx.Frame):
lambda event , mindex = index : self . delete_password ( mindex ) ,
dbtn )
self . pnl . SetupScrolling ( )
self . sizer . Layout ( )
@redraw
def show_password ( self , index ) :
""" show_password.
: param index :
"""
self . sizer . Clear ( delete_windows = True )
self . add_tools ( index )
passpath = self . pass_handler . get_pass_path_from_index ( index , " password " )
cpath = self . pass_handler . top_dir + os . path . dirname ( passpath )
@ -291,14 +305,13 @@ class PassUi(wx.Frame):
path , mtext ) ,
sbtn )
self . pnl . SetupScrolling ( )
self . sizer . Layout ( )
@redraw
def show_tools ( self , index = None ) :
""" show_tools.
: param index :
"""
self . sizer . Clear ( delete_windows = True )
btn = wx . Button ( self . pnl , label = " Go back " )
font = btn . GetFont ( ) . MakeBold ( )
btn . SetFont ( font )
@ -315,7 +328,6 @@ class PassUi(wx.Frame):
nbtn )
self . add_push_pull ( )
self . pnl . SetupScrolling ( )
self . sizer . Layout ( )
if __name__ == ' __main__ ' :