all: Use python3

This commit is contained in:
Michael Webster 2020-03-30 11:11:23 -04:00
parent e603bee1f3
commit d694deb65e
13 changed files with 41 additions and 39 deletions

2
debian/rules vendored
View File

@ -3,7 +3,7 @@
DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
%: %:
dh ${@} --with-python2 dh ${@} --with-python3
# Inject version number in the code # Inject version number in the code
override_dh_installdeb: override_dh_installdeb:

View File

@ -1,13 +1,13 @@
#!/usr/bin/python2 #!/usr/bin/python3
import sys, os import sys, os
if len(sys.argv) > 1: if len(sys.argv) > 1:
if (sys.argv[1] in ["help", "h", "-?", "--help", "-h", "?"]): if (sys.argv[1] in ["help", "h", "-?", "--help", "-h", "?"]):
print "mintMenu - the advanced MATE menu\n" print("mintMenu - the advanced MATE menu\n")
print "options:" print("options:")
print " [--]help, [-]h Display this help." print(" [--]help, [-]h Display this help.")
print " [--]clean, [--]clear, [--]reset Restore settings to default.\n" print(" [--]clean, [--]clear, [--]reset Restore settings to default.\n")
elif (sys.argv[1] in ["clean", "clear", "reset", "--clean", "--clear", "--reset"]): elif (sys.argv[1] in ["clean", "clear", "reset", "--clean", "--clear", "--reset"]):
os.system("gsettings reset-recursively com.linuxmint.mintmenu") os.system("gsettings reset-recursively com.linuxmint.mintmenu")
os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.places") os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.places")
@ -15,6 +15,6 @@ if len(sys.argv) > 1:
os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.recent") os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.recent")
os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.system_management") os.system("gsettings reset-recursively com.linuxmint.mintmenu.plugins.system_management")
os.system("rm -rf ~/.linuxmint/mintMenu") os.system("rm -rf ~/.linuxmint/mintMenu")
print "All mintMenu settings are now restored to default" print("All mintMenu settings are now restored to default")
else: else:
os.system("/usr/lib/linuxmint/mintMenu/mintMenu.py") os.system("/usr/lib/linuxmint/mintMenu/mintMenu.py")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
# -*- coding: utf-8; -*- # -*- coding: utf-8; -*-
# Copyright (C) 2013 Ozcan Esen <ozcanesen@gmail.com> # Copyright (C) 2013 Ozcan Esen <ozcanesen@gmail.com>
@ -118,7 +118,7 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
self.grab(self.keytext) self.grab(self.keytext)
def get_mask_combinations(self, mask): def get_mask_combinations(self, mask):
return [x for x in xrange(mask+1) if not (x & ~mask)] return [x for x in range(mask+1) if not (x & ~mask)]
def idle(self): def idle(self):
self.emit("activate") self.emit("activate")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import locale import locale
import gc import gc
@ -131,7 +131,7 @@ class MainWindow(object):
try: try:
X = __import__(plugin) X = __import__(plugin)
# If no parameter passed to plugin it is autonomous # If no parameter passed to plugin it is autonomous
if X.pluginclass.__init__.func_code.co_argcount == 1: if X.pluginclass.__init__.__code__.co_argcount == 1:
MyPlugin = X.pluginclass() MyPlugin = X.pluginclass()
else: else:
# pass mintMenu and togglebutton instance so that the plugin can use it # pass mintMenu and togglebutton instance so that the plugin can use it
@ -433,7 +433,6 @@ class MenuWin(object):
if os.path.isfile("/etc/linuxmint/info"): if os.path.isfile("/etc/linuxmint/info"):
with open("/etc/linuxmint/info") as info: with open("/etc/linuxmint/info") as info:
for line in info: for line in info:
line = line.decode("utf-8")
if line.startswith("DESCRIPTION="): if line.startswith("DESCRIPTION="):
tooltip = line.split("=",1)[1].strip('"\n') tooltip = line.split("=",1)[1].strip('"\n')
self.systemlabel.set_tooltip_text(tooltip) self.systemlabel.set_tooltip_text(tooltip)

View File

@ -1 +1 @@
#!/usr/bin/python2 #!/usr/bin/python3

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import cgi import cgi
import filecmp import filecmp
@ -7,7 +7,7 @@ import locale
import os import os
import subprocess import subprocess
import threading import threading
import urllib import urllib.request, urllib.parse, urllib.error
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
@ -997,17 +997,17 @@ class pluginclass(object):
self.focusSearchEntry(clear = False) self.focusSearchEntry(clear = False)
def search_ddg(self, widget): def search_ddg(self, widget):
text = urllib.quote_plus(self.searchEntry.get_text().strip()) text = urllib.parse.quote_plus(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://duckduckgo.com/?q=%s" % text]) subprocess.Popen(["xdg-open", "https://duckduckgo.com/?q=%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_google(self, widget): def search_google(self, widget):
text = urllib.quote_plus(self.searchEntry.get_text().strip()) text = urllib.parse.quote_plus(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://www.google.com/search?q=%s" % text]) subprocess.Popen(["xdg-open", "https://www.google.com/search?q=%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_wikipedia(self, widget): def search_wikipedia(self, widget):
text = urllib.quote_plus(self.searchEntry.get_text().strip()) text = urllib.parse.quote_plus(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://en.wikipedia.org/wiki/Special:Search?search=%s" % text]) subprocess.Popen(["xdg-open", "https://en.wikipedia.org/wiki/Special:Search?search=%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
@ -1017,27 +1017,27 @@ class pluginclass(object):
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_tutorials(self, widget): def search_mint_tutorials(self, widget):
text = urllib.quote(self.searchEntry.get_text().strip()) text = urllib.parse.quote(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/tutorial/search/0/%s" % text]) subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/tutorial/search/0/%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_ideas(self, widget): def search_mint_ideas(self, widget):
text = urllib.quote(self.searchEntry.get_text().strip()) text = urllib.parse.quote(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/idea/search/0/%s" % text]) subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/idea/search/0/%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_users(self, widget): def search_mint_users(self, widget):
text = urllib.quote(self.searchEntry.get_text().strip()) text = urllib.parse.quote(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/user/search/0/%s" % text]) subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/user/search/0/%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_hardware(self, widget): def search_mint_hardware(self, widget):
text = urllib.quote(self.searchEntry.get_text().strip()) text = urllib.parse.quote(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/hardware/search/0/%s" % text]) subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/hardware/search/0/%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_software(self, widget): def search_mint_software(self, widget):
text = urllib.quote(self.searchEntry.get_text()) text = urllib.parse.quote(self.searchEntry.get_text())
subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/software/search/0/%s" % text]) subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/software/search/0/%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import os.path import os.path
import shutil import shutil
@ -128,7 +128,7 @@ class easyButton(Gtk.Button):
if labels: if labels:
for label in labels: for label in labels:
if isinstance(label, basestring): if isinstance(label, str):
self.addLabel(label) self.addLabel(label)
elif isinstance(label, list): elif isinstance(label, list):
self.addLabel(label[0], label[1]) self.addLabel(label[0], label[1])
@ -317,13 +317,16 @@ class ApplicationLauncher(easyButton):
return True return True
def strip_accents(self, string): def strip_accents(self, string):
value = string # FIXME: Is this right??
if isinstance(string, unicode): return string
try: # value = string
value = string.encode('UTF8', 'ignore') # print(value, "...")
except: # if isinstance(string, str):
pass # try:
return value # value = string.encode('UTF8', 'ignore')
# except:
# pass
# return value
def getTooltip(self): def getTooltip(self):
tooltip = self.appName tooltip = self.appName

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import os import os
from gi.repository import Gio from gi.repository import Gio

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import os import os
import os.path import os.path

View File

@ -1,11 +1,11 @@
#!/usr/bin/python2 #!/usr/bin/python3
import locale import locale
import gettext import gettext
import os import os
import string import string
from glob import glob from glob import glob
from urllib import unquote from urllib.parse import unquote
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import gettext import gettext
import locale import locale

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
import os import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python
import threading import threading