Beispiel #1
0
class Parti(object):
    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)

        self._trays = TraySet()
        self._trays.connect("changed", self._desktop_list_changed)

        # Create our display stage
        self._world_organizer = WorldOrganizer(self._trays)
        self._wm.get_property("toplevel").add(self._world_organizer)
        self._world_organizer.show_all()

        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"})
        self._root_hotkeys.connect("hotkey::repl",
                                   lambda *args: self.spawn_repl_window())

        for window in self._wm.get_property("windows"):
            self._add_new_window(window)

        # Start providing D-Bus api
        self._dbus = PartiDBusService(self)

    def main(self):
        gtk.main()

    def _wm_quit(self, *args):
        gtk_main_quit_really()

    def _new_window_signaled(self, wm, window):
        self._add_new_window(window)

    def _add_new_window(self, window):
        # FIXME: be less stupid
        self._trays.trays[0].add(window)

    def _desktop_list_changed(self, *args):
        self._wm.emit("desktop-list-changed", self._trays.tags())

    def spawn_repl_window(self):
        spawn_repl_window(
            self._wm, {
                "parti": self,
                "wm": self._wm,
                "windows": self._wm.get_property("windows"),
                "trays": self._trays,
                "lowlevel": wimpiggy.lowlevel
            })
Beispiel #2
0
class Parti(object):
    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)

        self._trays = TraySet()
        self._trays.connect("changed", self._desktop_list_changed)
        
        # Create our display stage
        self._world_organizer = WorldOrganizer(self._trays)
        self._wm.get_property("toplevel").add(self._world_organizer)
        self._world_organizer.show_all()

        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"})
        self._root_hotkeys.connect("hotkey::repl",
                                   lambda *args: self.spawn_repl_window())

        for window in self._wm.get_property("windows"):
            self._add_new_window(window)

        # Start providing D-Bus api
        self._dbus = PartiDBusService(self)

    def main(self):
        gtk.main()

    def _wm_quit(self, *args):
        gtk_main_quit_really()

    def _new_window_signaled(self, wm, window):
        self._add_new_window(window)

    def _add_new_window(self, window):
        # FIXME: be less stupid
        self._trays.trays[0].add(window)

    def _desktop_list_changed(self, *args):
        self._wm.emit("desktop-list-changed", self._trays.tags())

    def spawn_repl_window(self):
        spawn_repl_window(self._wm,
                          {"parti": self,
                           "wm": self._wm,
                           "windows": self._wm.get_property("windows"),
                           "trays": self._trays,
                           "lowlevel": wimpiggy.lowlevel})
Beispiel #3
0
class Parti(object):
    def __init__(self, replace_other_wm):
        self._wm = Wm("Parti", replace_other_wm)
        self._wm.connect("new-window", self._new_window_signaled)
        self._wm.connect("quit", self._wm_quit)

        self._trays = TraySet()
        self._trays.connect("changed", self._desktop_list_changed)
        
        # Create our display stage
        self._world_organizer = WorldOrganizer(self._trays)
        self._wm.get_property("toplevel").add(self._world_organizer)
        self._world_organizer.show_all()

        # FIXME: be less stupid
        #self._trays.new(u"default", SimpleTabTray)
        from parti.trays.compositetest import CompositeTest
        self._trays.new(u"default", CompositeTest)

        self._root_hotkeys = HotkeyManager(gtk.gdk.get_default_root_window())
        self._root_hotkeys.add_hotkeys({"<shift><alt>r": "repl"})
        self._root_hotkeys.connect("hotkey::repl",
                                   lambda *args: self.spawn_repl_window())

        for window in self._wm.get_property("windows"):
            self._add_new_window(window)

        # Start providing D-Bus api
        self._dbus = PartiDBusService(self)

    def main(self):
        gtk.main()

    def _wm_quit(self, *args):
        gtk_main_quit_really()

    def _new_window_signaled(self, wm, window):
        self._add_new_window(window)

    def _add_new_window(self, window):
        # FIXME: be less stupid
        self._trays.trays[0].add(window)

    def _desktop_list_changed(self, *args):
        self._wm.emit("desktop-list-changed", self._trays.tags())

    def spawn_repl_window(self):
        spawn_repl_window(self._wm,
                          {"parti": self,
                           "wm": self._wm,
                           "windows": self._wm.get_property("windows"),
                           "trays": self._trays,
                           "lowlevel": wimpiggy.lowlevel})