[Parti-discuss] [PATCH] Added -t|--tray <TrayClass> option to partiwm
Nathaniel Smith
njs at pobox.com
Fri May 7 12:06:06 PDT 2010
Thanks! Applied.
On Fri, May 7, 2010 at 11:05 AM, Kipling Inscore <kinscore at synaptics.com> wrote:
> # HG changeset patch
> # User Kipling Inscore <k at bijna.net>
> # Date 1273253666 25200
> # Node ID 02a11677e8011e7044c1f3ef2931792174d2d6e2
> # Parent 604e612777eab521c7f92450a90cbd2b6fbb53d1
> Added -t|--tray <TrayClass> option to partiwm
> Changed CompositeTest to CompositeTestTray for consistency
>
> diff -r 604e612777ea -r 02a11677e801 parti/parti_main.py
> --- a/parti/parti_main.py Wed Feb 17 18:47:28 2010 -0800
> +++ b/parti/parti_main.py Fri May 07 10:34:26 2010 -0700
> @@ -20,8 +20,8 @@
> from parti.bus import PartiDBusService
>
> class Parti(object):
> - def __init__(self, replace_other_wm):
> - self._wm = Wm("Parti", replace_other_wm)
> + def __init__(self, options):
> + self._wm = Wm("Parti", options.replace)
> self._wm.connect("new-window", self._new_window_signaled)
> self._wm.connect("quit", self._wm_quit)
>
> @@ -33,11 +33,12 @@
> self._wm.get_property("toplevel").add(self._world_organizer)
> self._world_organizer.show_all()
>
> - # FIXME: be less stupid
> - #from parti.trays.simpletab import SimpleTabTray
> - #self._trays.new(u"default", SimpleTabTray)
> - from parti.trays.compositetest import CompositeTest
> - self._trays.new(u"default", CompositeTest)
> + ltray = options.tray.lower()
> + # __import__ returns topmost module and getattr will not get sub-modules not imported
> + # thus (using these two functions) the module path must be specified twice
> + dynmodule = getattr(getattr(__import__('parti.trays.' + ltray), 'trays'), ltray)
> + dynclass = getattr(dynmodule, options.tray + "Tray")
> + self._trays.new(u"default", dynclass)
>
> self._root_hotkeys = HotkeyManager(gtk.gdk.get_default_root_window())
> self._root_hotkeys.add_hotkeys({"<shift><alt>r": "repl"})
> diff -r 604e612777ea -r 02a11677e801 parti/scripts/main.py
> --- a/parti/scripts/main.py Wed Feb 17 18:47:28 2010 -0800
> +++ b/parti/scripts/main.py Fri May 07 10:34:26 2010 -0700
> @@ -14,6 +14,9 @@
> parser.add_option("--replace", action="store_true",
> dest="replace", default=False,
> help="Replace any running window manager with Parti")
> + parser.add_option("-t", "--tray",
> + dest="tray", default="CompositeTest",
> + help="Set default tray type")
> (options, args) = parser.parse_args(cmdline[1:])
>
> # This means, if an exception propagates to the gtk mainloop, then pass it
> @@ -22,7 +25,7 @@
> os.environ["PYGTK_FATAL_EXCEPTIONS"] = "1"
>
> try:
> - p = parti.parti_main.Parti(options.replace)
> + p = parti.parti_main.Parti(options)
> p.main()
> except:
> if "_PARTI_PDB" in os.environ:
> diff -r 604e612777ea -r 02a11677e801 parti/trays/compositetest.py
> --- a/parti/trays/compositetest.py Wed Feb 17 18:47:28 2010 -0800
> +++ b/parti/trays/compositetest.py Fri May 07 10:34:26 2010 -0700
> @@ -7,9 +7,9 @@
> import parti.tray
> from wimpiggy.window import WindowView
>
> -class CompositeTest(parti.tray.Tray, gtk.HPaned):
> +class CompositeTestTray(parti.tray.Tray, gtk.HPaned):
> def __init__(self, trayset, tag):
> - super(CompositeTest, self).__init__(trayset, tag)
> + super(CompositeTestTray, self).__init__(trayset, tag)
> self.windows = []
> # Hack to start the spacer in the middle of the window
> self.set_position(gtk.gdk.screen_width() / 2)
>
> _______________________________________________
> Parti-discuss mailing list
> Parti-discuss at partiwm.org
> http://lists.partiwm.org/cgi-bin/mailman/listinfo/parti-discuss
>
More information about the Parti-discuss
mailing list