diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2023-01-19 18:01:26 +0100 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-20 13:05:37 +0900 |
commit | 94f5a3f12e1c61aa2f3cde2d7b260c08489336ac (patch) | |
tree | 9062a30a1d81a1a97e9397548e4ec48ae63c18a4 /grubconfig | |
parent | b9c0b6996a6da72f93baf50121a1be4a6fa48d2e (diff) | |
download | tde-guidance-94f5a3f12e1c61aa2f3cde2d7b260c08489336ac.tar.gz tde-guidance-94f5a3f12e1c61aa2f3cde2d7b260c08489336ac.zip |
Drop python2 support.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'grubconfig')
-rw-r--r-- | grubconfig/grubconfig.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/grubconfig/grubconfig.py b/grubconfig/grubconfig.py index 8cf8ff2..d9d24a4 100644 --- a/grubconfig/grubconfig.py +++ b/grubconfig/grubconfig.py @@ -75,8 +75,8 @@ class GrubConfigAppClass(programbase): #--- Load menu.lst using the load_menulst() method self.load_menulst() - print self.globalvars - print self.itemslist + print(self.globalvars) + print(self.itemslist) # - GRUB Options Tab - if standalone: @@ -273,12 +273,12 @@ class GrubConfigAppClass(programbase): self.oslistview.setSelected(self.oslistviewitems[0],True) ops_list = self.load_osprobe() - print ops_list # mhb debug + print(ops_list) # mhb debug ####################################################################### # reload listviews, because they have changed def reloadListViews(self,name): - print "reloaded" + print("reloaded") # you should repaint the one that is not changed on screen if name == "oslist": self.oslistview.clear() @@ -298,7 +298,7 @@ class GrubConfigAppClass(programbase): for item in self.itemslist: try: if self.itemslist.index(item) == int(self.globalvars['default'][0]): - print "bam!" + print("bam!") self.itemslistviewitems.append(BoldListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0])) else: self.itemslistviewitems.append(TDEListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0])) @@ -349,12 +349,12 @@ class GrubConfigAppClass(programbase): self.customoptions.setText(customoptions[:-1]) self.updatingGUI = False - print "oslistview item selected" #mhb debug + print("oslistview item selected") #mhb debug pass ####################################################################### def slotDisplayNameLabelChanged(self, string): if(self.updatingGUI == False): - print "display name changed" #mhb debug + print("display name changed") #mhb debug i = self.oslistviewitems.index(self.oslistview.selectedItem()) self.itemslist[i]["title"][0] = string self.oslistview.selectedItem().setText(0,string) @@ -362,7 +362,7 @@ class GrubConfigAppClass(programbase): pass ####################################################################### def slotUpButtonClicked(self): - print "UpButton clicked" #mhb debug + print("UpButton clicked") #mhb debug i = self.itemslistviewitems.index(self.itemslistview.selectedItem()) self.itemslistview.selectedItem().itemAbove().moveItem(self.itemslistview.selectedItem()) # itemslist should have the same i for the same option @@ -375,7 +375,7 @@ class GrubConfigAppClass(programbase): ####################################################################### def slotDownButtonClicked(self): - print "DownButton clicked" #mhb debug + print("DownButton clicked") #mhb debug i = self.itemslistviewitems.index(self.itemslistview.selectedItem()) self.itemslistview.selectedItem().moveItem(self.itemslistview.selectedItem().itemBelow()) if(i != len(self.itemslist)-1): @@ -387,7 +387,7 @@ class GrubConfigAppClass(programbase): ####################################################################### def slotSetDefaultButtonClicked(self): - print "SetDefaultButton cliicked" #mhb debug + print("SetDefaultButton cliicked") #mhb debug try: defaultn = int(self.globalvars["default"][0]) except ValueError: @@ -419,7 +419,7 @@ class GrubConfigAppClass(programbase): #self.__updateGroupList() self.updatingGUI = False programbase.exec_loop(self) - print "done" + print("done") ####################################################################### @@ -453,7 +453,7 @@ class GrubConfigAppClass(programbase): for line in menufd: # Checks if the first non-white char in a line is a # if re.search(r'^(/s)*#',line) or re.search(r'^(/s)*$',line): - print "a commented line" # mhb debug + print("a commented line") # mhb debug if itemlock == 1: itemlock = 0 currentitem += 1 @@ -499,7 +499,7 @@ class GrubConfigAppClass(programbase): pass # okay, it's not commented else: - print "a not commented line" # mhb debug + print("a not commented line") # mhb debug self.modifiedlines.append(linenum) # we presume the first character is already a name var_name = line.split()[0] @@ -509,7 +509,7 @@ class GrubConfigAppClass(programbase): if var_name in parsable: # cat 0 - a title - triggers itemlock, has a name and a value, which should be stored as text if var_name == "title": - print line.split(None,1) + print(line.split(None,1)) var_value.append(line.split(None,1)[1][:-1]) itemlock = 1 self.itemslist.append({}) @@ -561,7 +561,7 @@ class GrubConfigAppClass(programbase): #print "it has no value" # mhb debug # print "parsed another line" # mhb debug linenum += 1; - print "load_menulst() called" # mhb debug + print("load_menulst() called") # mhb debug return "not working yet" ####################################################################### @@ -576,7 +576,7 @@ class GrubConfigAppClass(programbase): # 2. writing the lines in another list (or something more efficient output = {} # the globals first - for unit, value in self.globalvars.items(): + for unit, value in list(self.globalvars.items()): lines.append(value[-1]) temp_str="" temp_str+=(str(unit)+" ") @@ -586,7 +586,7 @@ class GrubConfigAppClass(programbase): # itemslist next (abattoir) for item in self.itemslist: - for unit, value in reversed(item.items()): + for unit, value in reversed(list(item.items())): lines.append(value[-1]) temp_str="" temp_str+=(str(unit)+" ") @@ -605,8 +605,8 @@ class GrubConfigAppClass(programbase): # read the menu.lst again (or rather its copy, to prevent the file being changed) # line by line write it in the output file (to be exact, to a file in /tmp) linenum = 0 - print linecontent - print lines + print(linecontent) + print(lines) # foreach file as line: for originalline in trfile: # if its number isn't in the location list, simply write it @@ -627,7 +627,7 @@ class GrubConfigAppClass(programbase): # mhb TODO: Exception handling os.remove(self.readfilename) - print "save_menulst() called" # mhb debug + print("save_menulst() called") # mhb debug return "not working yet" @@ -637,10 +637,10 @@ class GrubConfigAppClass(programbase): detected = os.popen('os-prober').readlines() ops_list = [] for ops in detected: - ops = string.replace(ops,"\n","") + ops = ops.replace("\n","") temp_list = ops.split(':') partition = temp_list[0] - temp_list[0] = string.replace(temp_list[0],"/dev/","") + temp_list[0] = temp_list[0].replace("/dev/","") re_obj = re.search(r'([sh]d)([a-z])([0-9])*$',temp_list[0]) disk = ord(re_obj.group(2))%97 part = int(re_obj.group(3))-1 @@ -662,7 +662,7 @@ class GrubConfigAppClass(programbase): linux_os = os.popen('linux-boot-prober '+partition).readlines() linux_list = [] for lops in linux_os: - lops = string.replace(lops,"\n","") + lops = lops.replace("\n","") temp_linux_list = lops.split(':') linux_list.append(temp_linux_list) temp_list.append(linux_list) @@ -680,7 +680,7 @@ def create_grubconfig(parent,name): ########################################################################## def MakeAboutData(): aboutdata = TDEAboutData("guidance", programname, version, - unicode(i18n("Boot Loader Configuration Tool")).encode(locale.getpreferredencoding()), + str(i18n("Boot Loader Configuration Tool")).encode(locale.getpreferredencoding()), TDEAboutData.License_GPL, "Copyright (C) 2006-2007 Martin Böhm") aboutdata.addAuthor("Martin Böhm", "Developer", "martin.bohm@kubuntu.org", "http://mhb.ath.cx/") aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/") |