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 ' ')
%:
dh ${@} --with-python2
dh ${@} --with-python3
# Inject version number in the code
override_dh_installdeb:

View File

@ -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")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
# -*- coding: utf-8; -*-
# Copyright (C) 2013 Ozcan Esen <ozcanesen@gmail.com>
@ -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")

View File

@ -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)

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 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()

View File

@ -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

View File

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

View File

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

View File

@ -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")

View File

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

View File

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

View File

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