@@ -711,21 +711,18 @@ def __init__(self, session, *args):
711711 self ["key_red" ] = StaticText ()
712712 self ["key_green" ] = StaticText ()
713713 self ["description" ] = Label ()
714- greenAction = (self .rootInit , _ ("Start the Chkroot initialization" ))
715- if BoxInfo .getItem ("hasUBIMB" ):
716- greenAction = (self .UBIMBInit , _ ("Start the Chkroot initialization" ))
717714 self ["actions" ] = HelpableActionMap (self , ["OkCancelActions" , "ColorActions" ], {
718715 "ok" : (self .close , _ ("Close the Chkroot MultiBoot Manager" )),
719716 "cancel" : (self .close , _ ("Close the Chkroot MultiBoot Manager" )),
720717 "red" : (self .disableChkroot , _ ("Disable the MultiBoot option" )),
721- "green" : greenAction
718+ "green" : ( self . ubimbInit if BoxInfo . getItem ( "hasUBIMB" ) else self . rootInit , _ ( "Start the Chkroot initialization" ))
722719 }, prio = - 1 , description = _ ("Chkroot Manager Actions" ))
723720 self ["key_red" ].setText (_ ("Disable Chkroot" ))
724721 self ["key_green" ].setText (_ ("Initialize" ))
725722 self .descriptionSuffix = _ ("The %s %s will reboot within 1 seconds." ) % getBoxDisplayName ()
726723 self ["description" ].setText ("%s\n \n %s" % (_ ("Press GREEN to enable MultiBoot!" ), self .descriptionSuffix ))
727724
728- def UBIMBInit (self ):
725+ def ubimbInit (self ):
729726 self .session .open (UBISlotManager )
730727
731728 def rootInit (self ):
@@ -917,9 +914,8 @@ def deviceSelectionCallback(self, selection):
917914 def partitionSizeGB (self , dev ):
918915 try :
919916 base = dev .replace ("/dev/" , "" )
920- pathClass = f"/sys/class/block/{ base } /size"
921- pathBlock = f"/sys/block/{ base } /size"
922- path = pathClass if exists (pathClass ) else pathBlock
917+ path = f"/sys/class/block/{ base } /size"
918+ path = path if exists (path ) else f"/sys/block/{ base } /size"
923919 with open (path ) as fd :
924920 blocks = int (fd .read ().strip ())
925921 return (blocks * 512 ) // (1024 * 1024 * 1024 )
0 commit comments