diff --git a/.gitignore b/.gitignore index 615af3b56..351d6fc2d 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ obt/obt-3.5.pc tools/gnome-panel-control/gnome-panel-control tools/gdm-control/gdm-control tools/obxprop/obxprop +tools/themeupdate/themeupdate.py version.h .libs .deps @@ -77,6 +78,7 @@ tests/grouptran tests/grouptran2 tests/grouptrancircular tests/grouptrancircular2 +tests/hideshow.py tests/iconifydelay tests/icons tests/mapiconic @@ -102,6 +104,7 @@ tests/urgent tests/usertimewin tests/wmhints data/autostart/openbox-autostart +data/autostart/openbox-xdg-autostart data/autostart/autostart obrender/rendertest obt/tests/bstest diff --git a/configure.ac b/configure.ac index ca1602670..fcb0d02a8 100644 --- a/configure.ac +++ b/configure.ac @@ -103,6 +103,8 @@ AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h grp.h locale.h pwd.h) AC_CHECK_HEADERS(signal.h string.h stdio.h stdlib.h unistd.h sys/stat.h) AC_CHECK_HEADERS(sys/select.h sys/socket.h sys/time.h sys/types.h sys/wait.h) +AM_PATH_PYTHON([2],,) + AC_PATH_PROG([SED], [sed], [no]) if test "$SED" = "no"; then AC_MSG_ERROR([The program "sed" is not available. This program is required to build Openbox.]) @@ -259,6 +261,9 @@ AC_CONFIG_FILES([ obrender/version.h obt/version.h version.h + data/autostart/openbox-xdg-autostart + tests/hideshow.py + tools/themeupdate/themeupdate.py ]) AC_CONFIG_COMMANDS([doc], [test -d doc || mkdir doc]) diff --git a/data/autostart/openbox-xdg-autostart b/data/autostart/openbox-xdg-autostart.in similarity index 77% rename from data/autostart/openbox-xdg-autostart rename to data/autostart/openbox-xdg-autostart.in index 04a17a199..3c365b112 100755 --- a/data/autostart/openbox-xdg-autostart +++ b/data/autostart/openbox-xdg-autostart.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!@PYTHON@ # openbox-xdg-autostart runs things based on the XDG autostart specification # Copyright (C) 2008 Dana Jansens @@ -28,9 +28,7 @@ try: from xdg.DesktopEntry import DesktopEntry from xdg.Exceptions import ParsingError except ImportError: - print - print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed" - print + sys.stderr.write("\nERROR: %s requires PyXDG to be installed\n" % ME) sys.exit(1) def main(argv=sys.argv): @@ -51,7 +49,7 @@ def main(argv=sys.argv): try: autofile = AutostartFile(path) except ParsingError: - print "Invalid .desktop file: " + path + print("Invalid .desktop file: " + path) else: if not autofile in files: files.append(autofile) @@ -99,9 +97,9 @@ class AutostartFile: def _alert(self, str, info=False): if info: - print "\t ", str + print("\t ", str) else: - print "\t*", str + print("\t*", str) def _showInEnvironment(self, envs, verbose=False): default = not self.de.getOnlyShowIn() @@ -146,14 +144,14 @@ class AutostartFile: def display(self, envs): if self._shouldRun(envs): - print "[*] " + self.de.getName() + print("[*] " + self.de.getName()) else: - print "[ ] " + self.de.getName() + print("[ ] " + self.de.getName()) self._alert("File: " + self.path, info=True) if self.de.getExec(): self._alert("Executes: " + self.de.getExec(), info=True) self._shouldRun(envs, True) - print + print() def run(self, envs): here = os.getcwd() @@ -165,34 +163,34 @@ class AutostartFile: os.chdir(here) def show_help(): - print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..." - print - print "This tool will run xdg autostart .desktop files" - print - print "OPTIONS" - print " --list Show a list of the files which would be run" - print " Files which would be run are marked with an asterix" - print " symbol [*]. For files which would not be run," - print " information is given for why they are excluded" - print " --help Show this help and exit" - print " --version Show version and copyright information" - print - print "ENVIRONMENT specifies a list of environments for which to run autostart" - print "applications. If none are specified, only applications which do not " - print "limit themselves to certain environments will be run." - print - print "ENVIRONMENT can be one or more of:" - print " GNOME Gnome Desktop" - print " KDE KDE Desktop" - print " ROX ROX Desktop" - print " XFCE XFCE Desktop" - print " Old Legacy systems" - print + print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...") + print() + print("This tool will run xdg autostart .desktop files") + print() + print("OPTIONS") + print(" --list Show a list of the files which would be run") + print(" Files which would be run are marked with an asterix") + print(" symbol [*]. For files which would not be run,") + print(" information is given for why they are excluded") + print(" --help Show this help and exit") + print(" --version Show version and copyright information") + print() + print("ENVIRONMENT specifies a list of environments for which to run autostart") + print("applications. If none are specified, only applications which do not ") + print("limit themselves to certain environments will be run.") + print() + print("ENVIRONMENT can be one or more of:") + print(" GNOME Gnome Desktop") + print(" KDE KDE Desktop") + print(" ROX ROX Desktop") + print(" XFCE XFCE Desktop") + print(" Old Legacy systems") + print() def show_version(): - print ME, VERSION - print "Copyright (c) 2008 Dana Jansens" - print + print(ME, VERSION) + print("Copyright (c) 2008 Dana Jansens") + print() if __name__ == "__main__": sys.exit(main()) diff --git a/tests/hideshow.py b/tests/hideshow.py.in similarity index 60% rename from tests/hideshow.py rename to tests/hideshow.py.in index 2e7fc3ae1..dc6ef9a18 100755 --- a/tests/hideshow.py +++ b/tests/hideshow.py.in @@ -1,50 +1,50 @@ -#!/usr/bin/env python +#!@PYTHON@ -import pygtk -import gtk -import gobject -pygtk.require('2.0') +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk +from gi.repository import GObject -class FolderSelector(gtk.Window): +class FolderSelector(Gtk.Window): def __init__(self, jules): - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - print "init folder selector", self, jules + Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL) + print("init folder selector", self, jules) self.set_title("Select Folder") self.jules = jules self.set_size_request(140, 200) - self.list_model = gtk.ListStore(gobject.TYPE_STRING) - self.tree = gtk.TreeView(self.list_model) - self.folder_column = gtk.TreeViewColumn('Folder') + self.list_model = Gtk.ListStore(GObject.TYPE_STRING) + self.tree = Gtk.TreeView(self.list_model) + self.folder_column = Gtk.TreeViewColumn('Folder') self.tree.append_column(self.folder_column) - self.folder_cell = gtk.CellRendererText() + self.folder_cell = Gtk.CellRendererText() self.folder_column.pack_start(self.folder_cell, True) self.folder_column.add_attribute(self.folder_cell, 'text', 0) self.tree.set_search_column(0) - self.icon_theme = gtk.icon_theme_get_default() + self.icon_theme = Gtk.IconTheme.get_default() self.add(self.tree) self.show_all() self.tree.columns_autosize() - print "done init" + print("done init") -class Jules(gtk.Window): +class Jules(Gtk.Window): def __init__(self): - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL) self.set_title("Jules") self.set_size_request(150, 320) self.connect("delete_event", self.on_delete_event) self.connect("destroy", self.on_destroy) - self.scroll = gtk.ScrolledWindow() + self.scroll = Gtk.ScrolledWindow() - self.tree_model = gtk.TreeStore(gobject.TYPE_STRING, - gobject.TYPE_STRING) - self.tree = gtk.TreeView(self.tree_model) - self.file_column = gtk.TreeViewColumn('name', gtk.CellRendererText(), + self.tree_model = Gtk.TreeStore(GObject.TYPE_STRING, + GObject.TYPE_STRING) + self.tree = Gtk.TreeView(self.tree_model) + self.file_column = Gtk.TreeViewColumn('name', Gtk.CellRendererText(), markup=0) self.file_column.set_sort_indicator(True) self.file_column.set_clickable(True) @@ -67,10 +67,10 @@ def on_delete_event(self, widget, event): return False def on_destroy(self, widget): - gtk.main_quit() + Gtk.main_quit() def run(self): - gtk.main() + Gtk.main() if __name__ == "__main__": diff --git a/tools/themeupdate/themeupdate.py b/tools/themeupdate/themeupdate.py.in similarity index 99% rename from tools/themeupdate/themeupdate.py rename to tools/themeupdate/themeupdate.py.in index c2ad6a75e..db2d160db 100755 --- a/tools/themeupdate/themeupdate.py +++ b/tools/themeupdate/themeupdate.py.in @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! @PYTHON@ # themeupdate.py for the Openbox window manager # This utility is for updating old themes from Blackbox, Fluxbox, and Openbox2 @@ -63,7 +63,7 @@ def simple_replace(data): pairs['textColor'] = 'text.color' pairs['interlaceColor'] = 'interlace.color' - for k in pairs.keys(): + for k in list(pairs.keys()): while 1: i, key, nul = find_key(data, k); if i >= 0: @@ -120,7 +120,7 @@ def simple_replace(data): pairs['window.button.hover.focus'] = 'window.active.button.hover.bg' pairs['window.button.hover.unfocus'] = 'window.inactive.button.hover.bg' - for k in pairs.keys(): + for k in list(pairs.keys()): while 1: i, key, nul = find_key(data, k, True); if i >= 0: @@ -173,7 +173,7 @@ def simple_replace(data): pairs['window.button.toggled.focus'] = 'window.active.button.toggled' pairs['window.button.toggled.unfocus'] = 'window.inactive.button.toggled' - for k in pairs.keys(): + for k in list(pairs.keys()): while 1: i, key, nul = find_key(data, k); if i >= 0: @@ -292,7 +292,7 @@ def xft_fonts(data): fonts['window'] = 'window.label.focus.font' fonts['menu.items'] = 'menu.items.font' fonts['menu.title'] = 'menu.title.font' - for f in fonts.keys(): + for f in list(fonts.keys()): li, nul, flags = find_key(data, f + '.xft.flags') if li < 0: li, nul, flags = find_key(data, '*.xft.flags') @@ -405,6 +405,6 @@ def usage(): err_missing(data) for l in data: - print l + print(l) sys.exit(not valid)