Пример #1
0
    def _change_window_fix_cb(self, settings, key):
        hint = self.fixed_window_hint \
            if settings.get_boolean(key) else Gdk.WindowTypeHint.NORMAL

        if hint == self.window.get_type_hint(): return

        self.window.hide()
        self.window.set_type_hint(hint)
        self.window.show()

        is_below = SETTINGS.get_boolean('window-fix') or \
            SETTINGS.get_boolean('window-keep-below')
        self.window.set_keep_below(is_below)

        if hint == Gdk.WindowTypeHint.NORMAL:
            if self.window.get_gravity() == Gdk.Gravity.CENTER:
                border = self.photoimage.window_border
                x = SETTINGS_GEOMETRY.get_int('root-x') - self.photoimage.w / 2
                y = SETTINGS_GEOMETRY.get_int('root-y') - self.photoimage.h / 2
                self.window.move(int(x - border), int(y - border))
            else:
                # a workaround for Xfwm bug (Issue #97)
                x = SETTINGS_GEOMETRY.get_int('root-x')
                y = SETTINGS_GEOMETRY.get_int('root-y')
                self.window.move(int(x), int(y))
Пример #2
0
    def _change_window_fix_cb(self, settings, key):
        hint = self.fixed_window_hint \
            if settings.get_boolean(key) else Gdk.WindowTypeHint.NORMAL

        if hint == self.window.get_type_hint(): return

        self.window.hide()
        self.window.set_type_hint(hint)
        self.window.show()

        is_below = SETTINGS.get_boolean('window-fix') or \
            SETTINGS.get_boolean('window-keep-below')
        self.window.set_keep_below(is_below)

        if hint == Gdk.WindowTypeHint.NORMAL:
            if self.window.get_gravity() == Gdk.Gravity.CENTER:
                border = self.photoimage.window_border
                x = SETTINGS_GEOMETRY.get_int('root-x') - self.photoimage.w / 2
                y = SETTINGS_GEOMETRY.get_int('root-y') - self.photoimage.h / 2
                self.window.move(int(x - border), int(y - border))
            else:
                # a workaround for Xfwm bug (Issue #97)
                x = SETTINGS_GEOMETRY.get_int('root-x')
                y = SETTINGS_GEOMETRY.get_int('root-y')
                self.window.move(int(x), int(y))
Пример #3
0
    def __init__(self, photolist):

        self.photolist = photolist
        self.fixed_window_hint = Gdk.WindowTypeHint.DOCK

        gui = Gtk.Builder()
        gui.add_objects_from_file(constants.UI_FILE, ["window"])

        SETTINGS.connect("changed::fullscreen", self._change_fullscreen_cb)
        SETTINGS.connect("changed::window-sticky", self._change_sticky_cb)
        SETTINGS.connect("changed::window-fix", self._change_window_fix_cb)
        SETTINGS.connect("changed::border-color", self._set_border_color)

        # a workaround for Xfwm bug (Issue #97)
        gravity = Gdk.Gravity.NORTH_WEST \
            if SETTINGS_GEOMETRY.get_string('gravity') == 'NORTH_WEST' \
            else Gdk.Gravity.CENTER

        self.window = gui.get_object('window')
        self.window.set_gravity(gravity)

        if SETTINGS.get_boolean('window-sticky'):
            self.window.stick()
        self._set_window_state()
        self._set_window_position()

        self._set_photoimage()
        self._set_event_box()
        self._set_popupmenu(self.photolist, self)
        self._set_accelerator()

        # FIXME: Why "query-tooltip" is not enable?
        self.window.connect("query-tooltip", self.photoimage.tooltip.query_tooltip_cb)
        gui.connect_signals(self)
Пример #4
0
    def __init__(self, photolist):

        self.photolist = photolist
        self.fixed_window_hint = Gdk.WindowTypeHint.DOCK

        gui = Gtk.Builder()
        gui.add_objects_from_file(constants.UI_FILE, ["window"])

        SETTINGS.connect("changed::fullscreen", self._change_fullscreen_cb)
        SETTINGS.connect("changed::window-sticky", self._change_sticky_cb)
        SETTINGS.connect("changed::window-fix", self._change_window_fix_cb)
        SETTINGS.connect("changed::border-color", self._set_border_color)

        # a workaround for Xfwm bug (Issue #97)
        gravity = Gdk.Gravity.NORTH_WEST \
            if SETTINGS_GEOMETRY.get_string('gravity') == 'NORTH_WEST' \
            else Gdk.Gravity.CENTER

        self.window = gui.get_object('window')
        self.window.set_gravity(gravity)

        if SETTINGS.get_boolean('window-sticky'):
            self.window.stick()
        self._set_window_state()
        self._set_window_position()

        self._set_photoimage()
        self._set_event_box()
        self._set_popupmenu(self.photolist, self)
        self._set_accelerator()

        # FIXME: Why "query-tooltip" is not enable?
        self.window.connect("query-tooltip",
                            self.photoimage.tooltip.query_tooltip_cb)
        gui.connect_signals(self)
Пример #5
0
    def start(self, widget, event):
        self.set_recent_menu()

        if SETTINGS.get_boolean('window-fix'):
            self.gui.get_object('menuitem6').set_active(True)

        photo = self.photoimage.photo
        accessible = photo.can_open() if photo else False
        self.set_open_menu_sensitive(accessible)

        is_fullscreen = SETTINGS.get_boolean('fullscreen')
        self.gui.get_object('menuitem8').set_active(is_fullscreen)

        self.gui.connect_signals(self)

        menu = self.gui.get_object('menu')
        menu.popup(None, None, None, None, event.button, event.time)
        self.is_show = True
Пример #6
0
    def start(self, widget, event):
        self.set_recent_menu()

        if SETTINGS.get_boolean('window-fix'):
            self.gui.get_object('menuitem6').set_active(True)

        photo = self.photoimage.photo
        accessible = photo.can_open() if photo else False
        self.set_open_menu_sensitive(accessible)

        is_fullscreen = SETTINGS.get_boolean('fullscreen')
        self.gui.get_object('menuitem8').set_active(is_fullscreen)

        self.gui.connect_signals(self)

        menu = self.gui.get_object('menu')
        menu.popup(None, None, None, None, event.button, event.time)
        self.is_show = True
Пример #7
0
    def on_window_leave_notify_event(self, widget, event):
#        if event.mode != 2:
#            return True
        self.photoimage.on_leave_cb(widget, event)

        # save geometry
        if not SETTINGS.get_boolean('window-fix'):
            x, y = widget.get_position()
            w, h = widget.get_size()

            if self.window.get_gravity() == Gdk.Gravity.CENTER:
                x += w / 2
                y += h / 2

            SETTINGS_GEOMETRY.set_int('root-x', x)
            SETTINGS_GEOMETRY.set_int('root-y', y)

        return False
Пример #8
0
    def on_window_leave_notify_event(self, widget, event):
        #        if event.mode != 2:
        #            return True
        self.photoimage.on_leave_cb(widget, event)

        # save geometry
        if not SETTINGS.get_boolean('window-fix'):
            x, y = widget.get_position()
            w, h = widget.get_size()

            if self.window.get_gravity() == Gdk.Gravity.CENTER:
                x += w / 2
                y += h / 2

            SETTINGS_GEOMETRY.set_int('root-x', x)
            SETTINGS_GEOMETRY.set_int('root-y', y)

        return False
Пример #9
0
 def _toggle_fullscreen(self, *args):
     state = not SETTINGS.get_boolean('fullscreen')
     SETTINGS.set_boolean('fullscreen', state)
Пример #10
0
 def _toggle_fullscreen(self, *args):
     state = not SETTINGS.get_boolean('fullscreen')
     SETTINGS.set_boolean('fullscreen', state)