diff --git a/debian/rules b/debian/rules index 0751f93..76e0f2e 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') %: - dh ${@} --with-python2 + dh ${@} --with-python3 # Inject version number in the code override_dh_installdeb: diff --git a/usr/bin/mintmenu b/usr/bin/mintmenu index 4c2cddb..be38368 100755 --- a/usr/bin/mintmenu +++ b/usr/bin/mintmenu @@ -1,13 +1,13 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import sys, os if len(sys.argv) > 1: if (sys.argv[1] in ["help", "h", "-?", "--help", "-h", "?"]): - print "mintMenu - the advanced MATE menu\n" - print "options:" - print " [--]help, [-]h Display this help." - print " [--]clean, [--]clear, [--]reset Restore settings to default.\n" + print("mintMenu - the advanced MATE menu\n") + print("options:") + print(" [--]help, [-]h Display this help.") + print(" [--]clean, [--]clear, [--]reset Restore settings to default.\n") 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.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.system_management") 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: os.system("/usr/lib/linuxmint/mintMenu/mintMenu.py") diff --git a/usr/lib/linuxmint/mintMenu/keybinding.py b/usr/lib/linuxmint/mintMenu/keybinding.py index a3bc421..b604404 100644 --- a/usr/lib/linuxmint/mintMenu/keybinding.py +++ b/usr/lib/linuxmint/mintMenu/keybinding.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 # -*- coding: utf-8; -*- # Copyright (C) 2013 Ozcan Esen @@ -118,7 +118,7 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread): self.grab(self.keytext) 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): self.emit("activate") diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 3ff3e63..13bf0b9 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import locale import gc @@ -131,7 +131,7 @@ class MainWindow(object): try: X = __import__(plugin) # 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() else: # 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"): with open("/etc/linuxmint/info") as info: for line in info: - line = line.decode("utf-8") if line.startswith("DESCRIPTION="): tooltip = line.split("=",1)[1].strip('"\n') self.systemlabel.set_tooltip_text(tooltip) diff --git a/usr/lib/linuxmint/mintMenu/plugins/__init__.py b/usr/lib/linuxmint/mintMenu/plugins/__init__.py index 0e1d5dd..a93a4bf 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/__init__.py +++ b/usr/lib/linuxmint/mintMenu/plugins/__init__.py @@ -1 +1 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index c52a83f..aeb3dfe 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import cgi import filecmp @@ -7,7 +7,7 @@ import locale import os import subprocess import threading -import urllib +import urllib.request, urllib.parse, urllib.error import gi gi.require_version("Gtk", "3.0") @@ -997,17 +997,17 @@ class pluginclass(object): self.focusSearchEntry(clear = False) 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() @@ -1017,27 +1017,27 @@ class pluginclass(object): self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() 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]) self.mintMenuWin.hide() diff --git a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py index e0ae576..82427c0 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py +++ b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import os.path import shutil @@ -128,7 +128,7 @@ class easyButton(Gtk.Button): if labels: for label in labels: - if isinstance(label, basestring): + if isinstance(label, str): self.addLabel(label) elif isinstance(label, list): self.addLabel(label[0], label[1]) @@ -317,13 +317,16 @@ class ApplicationLauncher(easyButton): return True def strip_accents(self, string): - value = string - if isinstance(string, unicode): - try: - value = string.encode('UTF8', 'ignore') - except: - pass - return value + # FIXME: Is this right?? + return string + # value = string + # print(value, "...") + # if isinstance(string, str): + # try: + # value = string.encode('UTF8', 'ignore') + # except: + # pass + # return value def getTooltip(self): tooltip = self.appName diff --git a/usr/lib/linuxmint/mintMenu/plugins/execute.py b/usr/lib/linuxmint/mintMenu/plugins/execute.py index 7835f2e..86b8c34 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/execute.py +++ b/usr/lib/linuxmint/mintMenu/plugins/execute.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import os from gi.repository import Gio diff --git a/usr/lib/linuxmint/mintMenu/plugins/filemonitor.py b/usr/lib/linuxmint/mintMenu/plugins/filemonitor.py index 482d170..f0dd1c2 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/filemonitor.py +++ b/usr/lib/linuxmint/mintMenu/plugins/filemonitor.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import os import os.path diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 0ba4d7e..614ae21 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -1,11 +1,11 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import locale import gettext import os import string from glob import glob -from urllib import unquote +from urllib.parse import unquote import gi gi.require_version("Gtk", "3.0") diff --git a/usr/lib/linuxmint/mintMenu/plugins/recent.py b/usr/lib/linuxmint/mintMenu/plugins/recent.py index f18a005..d2f90f7 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/recent.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recent.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import gettext import locale diff --git a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py index 2e2d571..aaa302f 100644 --- a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import os diff --git a/usr/lib/linuxmint/mintMenu/pointerMonitor.py b/usr/lib/linuxmint/mintMenu/pointerMonitor.py index 7f6292c..fc6f647 100644 --- a/usr/lib/linuxmint/mintMenu/pointerMonitor.py +++ b/usr/lib/linuxmint/mintMenu/pointerMonitor.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python import threading