From 39b21bf6af94e485d01a6ef6fdfd32ccfa1ca99e Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Sun, 14 Jan 2018 16:35:18 +0100 Subject: [PATCH] removing future imports not more needed since guake only supports Python 2 Signed-off-by: Gaetan Semet --- guake/__init__.py | 4 ---- guake/about.py | 1 - guake/common.py | 10 +++------- guake/dbusiface.py | 1 - guake/globals.py | 26 ++------------------------ guake/gsettings.py | 22 +--------------------- guake/guake_app.py | 24 +++--------------------- guake/guake_logging.py | 4 ---- guake/guake_notebook.py | 3 --- guake/keybindings.py | 1 + guake/main.py | 5 ----- guake/notifier.py | 4 ---- guake/prefs.py | 3 --- guake/settings.py | 3 --- guake/simplegladeapp.py | 4 ---- guake/terminal.py | 14 ++++++-------- 16 files changed, 16 insertions(+), 113 deletions(-) diff --git a/guake/__init__.py b/guake/__init__.py index 68929e4d..a6b64e16 100644 --- a/guake/__init__.py +++ b/guake/__init__.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import pbr.version diff --git a/guake/about.py b/guake/about.py index 5d691321..cf53787b 100644 --- a/guake/about.py +++ b/guake/about.py @@ -18,7 +18,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import import gi gi.require_version('Gtk', '3.0') diff --git a/guake/common.py b/guake/common.py index b1b1c9eb..d1418e8c 100644 --- a/guake/common.py +++ b/guake/common.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import gettext import os @@ -39,11 +35,11 @@ _ = gettext.gettext __all__ = [ '_', - 'ShowableError', - 'pixmapfile', + 'get_binaries_from_path', 'gladefile', 'hexify_color', - 'get_binaries_from_path', + 'pixmapfile', + 'ShowableError', ] diff --git a/guake/dbusiface.py b/guake/dbusiface.py index c44415fd..a82faf95 100755 --- a/guake/dbusiface.py +++ b/guake/dbusiface.py @@ -17,7 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import import dbus import dbus.glib diff --git a/guake/globals.py b/guake/globals.py index c5e31cac..4cb35136 100644 --- a/guake/globals.py +++ b/guake/globals.py @@ -17,7 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import import inspect import os @@ -25,8 +24,8 @@ import os import guake __all__ = [ - 'NAME', 'VERSION', 'IMAGE_DIR', 'GLADE_DIR', 'SCHEMA_DIR', 'LOCALE_DIR', 'GCONF_PATH', 'KEY', - 'ALIGN_CENTER', 'ALIGN_RIGHT', 'ALIGN_LEFT', 'ALIGN_TOP', 'ALIGN_BOTTOM', 'ALWAYS_ON_PRIMARY' + 'NAME', 'VERSION', 'IMAGE_DIR', 'GLADE_DIR', 'SCHEMA_DIR', 'LOCALE_DIR', 'ALIGN_CENTER', + 'ALIGN_RIGHT', 'ALIGN_LEFT', 'ALIGN_TOP', 'ALIGN_BOTTOM', 'ALWAYS_ON_PRIMARY' ] @@ -45,27 +44,6 @@ GLADE_DIR = os.path.join(SRC_DIR, 'data') SCHEMA_DIR = os.path.join(SRC_DIR, 'data') LOCALE_DIR = "/usr/share/locale" -# TODO port dead!? -# Gconf stuff. Yep, it is hardcoded =) -GCONF_PATH = '/apps/guake' - - -def KEY(x): - return (GCONF_PATH + x) - - -# Stuff used to build the treeview that will allow the user to change -# keybindings in the preferences window. - - -def LKEY(x): - return GCONF_PATH + '/keybindings/local/' + x - - -def GKEY(x): - return GCONF_PATH + '/keybindings/global/' + x - - ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT = range(3) ALIGN_TOP, ALIGN_BOTTOM = range(2) ALWAYS_ON_PRIMARY = -1 diff --git a/guake/gsettings.py b/guake/gsettings.py index f1ea64e5..20bb9add 100644 --- a/guake/gsettings.py +++ b/guake/gsettings.py @@ -17,19 +17,15 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function import gi gi.require_version('Gtk', '3.0') gi.require_version('Vte', '2.91') # vte-0.38 -from gi.repository import Vte - from gi.repository import Gdk from gi.repository import Gtk from gi.repository import Pango +from gi.repository import Vte import logging import subprocess @@ -40,10 +36,6 @@ import guake.notifier from guake.common import _ from guake.common import pixmapfile -from guake.globals import GCONF_PATH -from guake.globals import GKEY -from guake.globals import KEY -from guake.globals import LKEY GCONF_MONOSPACE_FONT_PATH = '/desktop/gnome/interface/monospace_font_name' DCONF_MONOSPACE_FONT_PATH = 'org.gnome.desktop.interface' @@ -65,18 +57,6 @@ class GSettingHandler(object): self.guake = guake_inst self.settings = guake_inst.settings settings = self.settings - # TODO PORT do we need this to be ported? - # client.add_dir(GCONF_PATH, gconf.CLIENT_PRELOAD_RECURSIVE) - - # these keys does not need to be watched. - # notify_add(KEY('/general/default_shell'), self.shell_changed) - # notify_add(KEY('/general/use_login_shell'), self.login_shell_toggled) - # notify_add(KEY('/general/use_popup'), self.popup_toggled) - # notify_add(KEY('/general/window_losefocus'), self.losefocus_toggled) - # notify_add(KEY('/general/use_vte_titles'), self.use_vte_titles_changed) - # notify_add(KEY('/general/quick_open_enable'), self.on_quick_open_enable_changed) - # notify_add(KEY('/general/quick_open_in_current_terminal'), - # self.on_quick_open_in_current_terminal_changed) # Notification is not required for mouse_display/display_n because # set_final_window_rect polls gconf and is called whenever Guake is diff --git a/guake/guake_app.py b/guake/guake_app.py index 47475618..dd2618e6 100644 --- a/guake/guake_app.py +++ b/guake/guake_app.py @@ -18,9 +18,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function import gi gi.require_version('Gtk', '3.0') @@ -36,27 +33,17 @@ from gi.repository import Gtk from gi.repository import Keybinder from gi.repository import Vte -# import gconf import json import logging import os import platform -# import pygtk -# needed for execute_hook import subprocess -# needed for sys.stderr.write(...) import sys -# needed for execute_hook import traceback -# import uuid -# import xdg.Exceptions import cairo from urllib.parse import quote_plus -# from urllib import url2pathname -# from urlparse import urlsplit -# from xdg.DesktopEntry import DesktopEntry from xml.sax.saxutils import escape as xml_escape from guake import notifier @@ -64,19 +51,14 @@ from guake.about import AboutDialog from guake.common import _ from guake.common import gladefile from guake.common import pixmapfile -# from guake.common import shell_quote -# from guake.gconfhandler import GConfHandler -# from guake.gconfhandler import GConfKeyHandler from guake.globals import ALIGN_BOTTOM from guake.globals import ALIGN_CENTER from guake.globals import ALIGN_LEFT from guake.globals import ALIGN_RIGHT from guake.globals import ALWAYS_ON_PRIMARY -from guake.globals import SCHEMA_DIR -# from guake.globals import GKEY -# from guake.globals import KEY from guake.globals import LOCALE_DIR from guake.globals import NAME +from guake.globals import SCHEMA_DIR from guake.gsettings import GSettingHandler from guake.guake_logging import setupLogging from guake.guake_notebook import GuakeNotebook @@ -87,8 +69,6 @@ from guake.simplegladeapp import SimpleGladeApp from guake.simplegladeapp import bindtextdomain from guake.terminal import GuakeTerminalBox -log = logging.getLogger(__name__) - libutempter = None try: # this allow to run some commands that requires libuterm to @@ -105,6 +85,8 @@ except Exception as e: sys.stderr.write("[WARN] The command will not work in guake !\n") sys.stderr.write("[WARN] " + str(e) + '\n') +log = logging.getLogger(__name__) + instance = None RESPONSE_FORWARD = 0 RESPONSE_BACKWARD = 1 diff --git a/guake/guake_logging.py b/guake/guake_logging.py index ba4bc260..923b643d 100644 --- a/guake/guake_logging.py +++ b/guake/guake_logging.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import logging.config diff --git a/guake/guake_notebook.py b/guake/guake_notebook.py index a933e4dc..c05390b2 100644 --- a/guake/guake_notebook.py +++ b/guake/guake_notebook.py @@ -17,9 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function import logging import posix diff --git a/guake/keybindings.py b/guake/keybindings.py index c35f8f4e..76fa61e1 100644 --- a/guake/keybindings.py +++ b/guake/keybindings.py @@ -17,6 +17,7 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ + import gi gi.require_version('Gtk', '3.0') diff --git a/guake/main.py b/guake/main.py index b56cd8f3..7c275553 100644 --- a/guake/main.py +++ b/guake/main.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import gi gi.require_version('Gtk', '3.0') @@ -38,7 +34,6 @@ from optparse import OptionParser from guake.common import _ -from guake.globals import KEY from guake.globals import VERSION from guake.dbusiface import DBUS_NAME diff --git a/guake/notifier.py b/guake/notifier.py index f1d2fc70..59beac2d 100644 --- a/guake/notifier.py +++ b/guake/notifier.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import gi gi.require_version('Notify', '0.7') diff --git a/guake/prefs.py b/guake/prefs.py index 2e754275..f52141d1 100644 --- a/guake/prefs.py +++ b/guake/prefs.py @@ -17,9 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function import gi gi.require_version('Gtk', '3.0') diff --git a/guake/settings.py b/guake/settings.py index b4015c12..39050159 100644 --- a/guake/settings.py +++ b/guake/settings.py @@ -18,9 +18,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function import gi gi.require_version('Gtk', '3.0') diff --git a/guake/simplegladeapp.py b/guake/simplegladeapp.py index 3529f47f..ee7ef2e2 100644 --- a/guake/simplegladeapp.py +++ b/guake/simplegladeapp.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import gi gi.require_version('Gtk', '3.0') diff --git a/guake/terminal.py b/guake/terminal.py index f2a75c78..f3f8ab7d 100644 --- a/guake/terminal.py +++ b/guake/terminal.py @@ -17,10 +17,6 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import gi gi.require_version('Gtk', '3.0') @@ -38,21 +34,23 @@ from guake.common import clamp from time import sleep +import code import logging import os import re import uuid + +import signal +import subprocess +import threading + log = logging.getLogger(__name__) -import code def halt(loc): code.interact(local=loc) -import signal -import subprocess -import threading # TODO PORT # __all__ = ['Terminal', 'TerminalBox']