예제 #1
0
    def __init__(self, exaile):
        """
            Sets up the mini mode main window and
            options to access it
        """
        Gtk.Window.__init__(self)
        self.set_title('Exaile Mini Mode')
        self.set_resizable(False)

        self.exaile_window = exaile.gui.main.window

        controls.register()

        self.box = controls.ControlBox()
        self.box.set_spacing(3)
        self.border_frame = Gtk.Frame()
        self.border_frame.add(self.box)
        self.add(self.border_frame)

        self.accelerator = Accelerator('<Primary><Alt>M', _('Mini Mode'),
                                       self.on_menuitem_activate)

        self.menuitem = menu.simple_menu_item('minimode', ['clear-playlist'],
                                              icon_name='exaile-minimode',
                                              callback=self.accelerator)

        providers.register('menubar-view-menu', self.menuitem)
        providers.register('mainwindow-accelerators', self.accelerator)

        self.mainbutton = Gtk.Button(label=_('Mini Mode'))
        self.mainbutton.set_image(
            Gtk.Image.new_from_icon_name('exaile-minimode',
                                         Gtk.IconSize.BUTTON))
        self.mainbutton.connect('clicked', self.on_mainbutton_clicked)
        action_area = exaile.gui.main.info_area.get_action_area()
        action_area.pack_end(self.mainbutton, False, False, 6)

        self.__active = False
        self.__dirty = True
        # XXX: Until defaults are implemented in xl.settings
        self.__defaults = {
            'plugin/minimode/always_on_top': True,
            'plugin/minimode/show_in_panel': False,
            'plugin/minimode/on_all_desktops': True,
            'plugin/minimode/display_window_decorations': True,
            'plugin/minimode/window_decoration_type': 'full',
            'plugin/minimode/use_alpha': False,
            'plugin/minimode/transparency': 0.3,
            'plugin/minimode/horizontal_position': 10,
            'plugin/minimode/vertical_position': 10
        }

        exaile.gui.main.connect('main-visible-toggle',
                                self.on_main_visible_toggle)
        event.add_ui_callback(self.on_option_set, 'plugin_minimode_option_set')
        self.on_option_set('plugin_minimode_option_set', settings,
                           'plugin/minimode/button_in_mainwindow')
예제 #2
0
    def __init__(self, exaile):
        """
            Sets up the mini mode main window and
            options to access it
        """
        gtk.Window.__init__(self)
        self.set_title('Exaile Mini Mode')
        self.set_resizable(False)

        self.exaile_window = exaile.gui.main.window

        controls.register()

        self.box = controls.ControlBox()
        self.box.set_spacing(3)
        alignment = gtk.Alignment(xscale=1, yscale=1)
        alignment.set_padding(0, 0, 3, 3)
        alignment.add(self.box)
        self.border_frame = gtk.Frame()
        self.border_frame.add(alignment)
        self.add(self.border_frame)

        self.menuitem = menu.simple_menu_item('minimode', ['clear-playlist'],
                                              _('Mini Mode'),
                                              'exaile-minimode',
                                              self.on_menuitem_activate,
                                              accelerator='<Control><Alt>M')
        self.accelerator = Accelerator('<Control><Alt>M',
                                       self.on_menuitem_activate)
        providers.register('menubar-view-menu', self.menuitem)
        providers.register('mainwindow-accelerators', self.accelerator)

        mainbutton = gtk.Button(_('Mini Mode'))
        mainbutton.set_image(
            gtk.image_new_from_icon_name('exaile-minimode',
                                         gtk.ICON_SIZE_BUTTON))
        mainbutton.connect('clicked', self.on_mainbutton_clicked)
        self.mainbutton_alignment = gtk.Alignment(xalign=1)
        self.mainbutton_alignment.add(mainbutton)
        action_area = exaile.gui.main.info_area.get_action_area()
        action_area.pack_start(self.mainbutton_alignment)
        action_area.reorder_child(self.mainbutton_alignment, 0)

        self.__active = False
        self.__dirty = True
        # XXX: Until defaults are implemented in xl.settings
        self.__defaults = {
            'plugin/minimode/always_on_top': True,
            'plugin/minimode/show_in_panel': False,
            'plugin/minimode/on_all_desktops': True,
            'plugin/minimode/display_window_decorations': True,
            'plugin/minimode/window_decoration_type': 'full',
            'plugin/minimode/use_alpha': False,
            'plugin/minimode/transparency': 0.3,
            'plugin/minimode/horizontal_position': 10,
            'plugin/minimode/vertical_position': 10
        }

        exaile.gui.main.connect('main-visible-toggle',
                                self.on_main_visible_toggle)
        event.add_callback(self.on_option_set, 'plugin_minimode_option_set')
        self.on_option_set('plugin_minimode_option_set', settings,
                           'plugin/minimode/button_in_mainwindow')