示例#1
0
    def _build_interface(self):
        self.widgets = {}
        self.vbox = gtk.VBox()
        self.vbox.set_spacing(3)

        self.list = common.list_view_new_icon_and_text(headers=None, ignore_first_column=True, one_header=True, select_multiple=False)
        self.vbox.pack_start(self.list)

        self.widgets['table'] = gtk.Table(rows=2, columns=2)
        self.widgets['table'].set_col_spacings(3)
        self.widgets['table'].set_row_spacings(3)
        self.vbox.pack_start(self.widgets['table'], expand=False, fill=True)

        self.widgets['button_run'] = common.button_new_with_image('gtk-execute', _("_Run"))
        self.widgets['table'].attach(self.widgets['button_run'], 0,1, 0,1,
                                     xoptions=gtk.EXPAND|gtk.FILL, yoptions=gtk.EXPAND|gtk.FILL)

        self.widgets['button_uninstall'] = common.button_new_with_image('gtk-remove', _("_Uninstall"))
        self.widgets['table'].attach(self.widgets['button_uninstall'], 1,2, 0,1,
                                     xoptions=gtk.EXPAND|gtk.FILL, yoptions=gtk.EXPAND|gtk.FILL)

        self.widgets['button_add'] = common.button_new_with_image('gtk-add', _("A_dd unlisted program"))
        self.widgets['table'].attach(self.widgets['button_add'], 0,2, 1,2,
                                     xoptions=gtk.EXPAND|gtk.FILL, yoptions=gtk.EXPAND|gtk.FILL)

        self.widgets['menu_programs'] = gtk.Menu()
        self.widgets['menu_programs_edit'] = gtk.MenuItem(_("_Edit program"), True)
        self.widgets['menu_programs'].append(self.widgets['menu_programs_edit'])
        self.widgets['menu_programs_separator'] = gtk.SeparatorMenuItem()
        self.widgets['menu_programs'].append(self.widgets['menu_programs_separator'])
        self.widgets['menu_programs_refresh'] = gtk.MenuItem(_("_Refresh program list"), True)
        self.widgets['menu_programs'].append(self.widgets['menu_programs_refresh'])
        self.widgets['menu_programs'].show_all()

        self.list.connect('changed', self.list_changed)
        self.list.connect('double-click', self.list_double_clicked)
        self.list.connect('right-click', self.list_right_clicked)
        self.widgets['button_run'].connect('clicked', self.button_run_clicked)
        self.widgets['button_uninstall'].connect('clicked', self.button_uninstall_clicked)
        self.widgets['button_add'].connect('clicked', self.button_add_clicked)

        self.widgets['menu_programs_edit'].connect("activate", self.menu_edit_clicked)
        self.widgets['menu_programs_refresh'].connect("activate", self.menu_refresh_clicked)

        self.list.set_drag_test_start_function(self._test_drag_start)
        self.list.set_drag_creation_function(self._drag_creation)

        self.frame = common.frame_wrap(self.vbox, self.title)
        self.pack_start(self.frame, True, True)

        self.dialog_edit_program = DialogEditProgram()
        self.dialog_edit_program.connect('response', self._on_edit_program_response)

        self.sizable = []

        self.show_all()
示例#2
0
    def _build_interface(self):
        self.hbox = gtk.HBox()
        self.label = gtk.Label('%s: ' % self.title)
        self.hbox.pack_start(self.label, False, False)
        self.filechooser = gtk.FileChooserButton(_("Select an executable"))
        self.filechooser.add_filter(common.filefilters['all'])
        self.filechooser.add_filter(common.filefilters['windows_executables'])
        self.filechooser.set_filter(common.filefilters['windows_executables'])
        self.filechooser.connect('file-set', self._on_filechooser_file_set)
        try:
            main_drive = wine.drives.get_main_drive(
                use_registry=False)['mapping']
            self.filechooser.add_shortcut_folder(main_drive)
        except:
            pass
        self.hbox.pack_start(self.filechooser, True, True)
        self.button_run = common.button_new_with_image(self.icon,
                                                       label=_("_Run"),
                                                       use_underline=True)
        self.hbox.pack_end(self.button_run, False, False)
        self.pack_start(self.hbox, True, False)
        self.button_run.set_sensitive(False)
        self.show_all()

        self.button_run.connect('clicked', self.button_clicked)
示例#3
0
    def _build_interface(self):
        self.button = common.button_new_with_image(self.icon, label=self.title, use_underline=False)
        self.button.set_tooltip_text(self.tooltip)
        self.pack_start(self.button)
        self.show_all()

        self.button.connect("clicked", self.button_clicked)
示例#4
0
    def _build_interface(self):
        self.button = common.button_new_with_image(self.icon,
                                                   label=self.title,
                                                   use_underline=False)
        self.pack_start(self.button)
        self.show_all()

        self.button.connect('clicked', self.button_clicked)
示例#5
0
    def _build_interface(self):
        self.vbox = gtk.VBox()

        self.installers = []
        installers = []
        for n, (title, section) in enumerate((
            (_('Programs'), self.installers_programs),
            (_('Extras'), self.installers_extras)
        )):
            if n == 0:
                installers.append([None, None, '<header first>%s</header>' % title])
            else:
                installers.append([None, None, '<header>%s</header>' % title])
            self.installers.append(('', '', ''))

            for i in section:
                try:
                    if len(i) > 1:
                        icon = common.pixbuf_new_from_string(i[1])
                        if icon == None:
                            icon = common.pixbuf_new_from_string('package-x-generic')
                        installers.append( (i[0], icon, '%s\n<small>%s</small>' % (i[2], i[3])) )
                    else:
                        installers.append( i[0] )
                    self.installers.append(i)
                except IndexError:
                    print i

        self.list = common.list_view_new_icon_and_text(headers=None, ignore_first_column=True, number_of_text_columns=1, text_column=2, use_markup=True, select_multiple=True, items=installers)
        self.vbox.pack_start(self.list)
        self.license_notice_label = gtk.Label(_('* Legally requires that you own a Windows license'))
        self.license_notice_label.set_alignment(1.0, 0.5)
        self.vbox.pack_start(self.license_notice_label, False, True)
        self.hbox_buttons = gtk.HBox()
        self.hbox_buttons.set_spacing(6)
        self.button_install = common.button_new_with_image('gtk-add', label=_("_Install"), use_underline=True)
        self.button_install.set_sensitive(False)
        self.hbox_buttons.pack_start(self.button_install, True, True)
        self.vbox.pack_start(self.hbox_buttons, False, True)

        self.list.connect('changed', self.list_changed)
        self.button_install.connect('clicked', self.button_install_clicked)

        self.frame = common.frame_wrap(self.vbox, self.title)
        self.pack_start(self.frame, True, True)

        self.sizable = []

        self.show_all()
        self.license_notice_label.hide()
示例#6
0
    def _build_interface(self):
        self.hbox = gtk.HBox()
        self.label = gtk.Label('%s: ' % self.title)
        self.hbox.pack_start(self.label, False, False)
        self.filechooser = gtk.FileChooserButton(_("Select an executable"))
        self.filechooser.add_filter(common.filefilters['all'])
        self.filechooser.add_filter(common.filefilters['windows_executables'])
        self.filechooser.set_filter(common.filefilters['windows_executables'])
        try:
            main_drive = wine.drives.get_main_drive(use_registry=False)['mapping']
            self.filechooser.add_shortcut_folder(main_drive)
        except:
            pass
        self.hbox.pack_start(self.filechooser, True, True)
        self.button_run = common.button_new_with_image(self.icon, label=_("_Run"), use_underline=True)
        self.hbox.pack_end(self.button_run, False, False)
        self.pack_start(self.hbox, True, False)
        self.show_all()

        self.button_run.connect('clicked', self.button_clicked)
示例#7
0
    def _build_interface(self):
        self.widgets = {}
        self.vbox = gtk.VBox()
        self.vbox.set_spacing(3)

        self.list = common.list_view_new_icon_and_text(
            headers=None,
            ignore_first_column=True,
            one_header=True,
            select_multiple=False)
        self.vbox.pack_start(self.list)

        self.widgets['table'] = gtk.Table(rows=2, columns=2)
        self.widgets['table'].set_col_spacings(3)
        self.widgets['table'].set_row_spacings(3)
        self.vbox.pack_start(self.widgets['table'], expand=False, fill=True)

        self.widgets['button_run'] = common.button_new_with_image(
            'gtk-execute', _("_Run"))
        self.widgets['table'].attach(self.widgets['button_run'],
                                     0,
                                     1,
                                     0,
                                     1,
                                     xoptions=gtk.EXPAND | gtk.FILL,
                                     yoptions=gtk.EXPAND | gtk.FILL)

        self.widgets['button_uninstall'] = common.button_new_with_image(
            'gtk-remove', _("_Uninstall"))
        self.widgets['table'].attach(self.widgets['button_uninstall'],
                                     1,
                                     2,
                                     0,
                                     1,
                                     xoptions=gtk.EXPAND | gtk.FILL,
                                     yoptions=gtk.EXPAND | gtk.FILL)

        self.widgets['button_add'] = common.button_new_with_image(
            'gtk-add', _("A_dd unlisted program"))
        self.widgets['table'].attach(self.widgets['button_add'],
                                     0,
                                     2,
                                     1,
                                     2,
                                     xoptions=gtk.EXPAND | gtk.FILL,
                                     yoptions=gtk.EXPAND | gtk.FILL)

        self.widgets['menu_programs'] = gtk.Menu()
        self.widgets['menu_programs_edit'] = gtk.MenuItem(
            _("_Edit program"), True)
        self.widgets['menu_programs'].append(
            self.widgets['menu_programs_edit'])
        self.widgets['menu_programs_separator'] = gtk.SeparatorMenuItem()
        self.widgets['menu_programs'].append(
            self.widgets['menu_programs_separator'])
        self.widgets['menu_programs_refresh'] = gtk.MenuItem(
            _("_Refresh program list"), True)
        self.widgets['menu_programs'].append(
            self.widgets['menu_programs_refresh'])
        self.widgets['menu_programs'].show_all()

        self.list.connect('changed', self.list_changed)
        self.list.connect('double-click', self.list_double_clicked)
        self.list.connect('right-click', self.list_right_clicked)
        self.widgets['button_run'].connect('clicked', self.button_run_clicked)
        self.widgets['button_uninstall'].connect('clicked',
                                                 self.button_uninstall_clicked)
        self.widgets['button_add'].connect('clicked', self.button_add_clicked)

        self.widgets['menu_programs_edit'].connect("activate",
                                                   self.menu_edit_clicked)
        self.widgets['menu_programs_refresh'].connect(
            "activate", self.menu_refresh_clicked)

        self.list.set_drag_test_start_function(self._test_drag_start)
        self.list.set_drag_creation_function(self._drag_creation)

        self.frame = common.frame_wrap(self.vbox, self.title)
        self.pack_start(self.frame, True, True)

        self.dialog_edit_program = DialogEditProgram()
        self.dialog_edit_program.connect('response',
                                         self._on_edit_program_response)

        self.sizable = []

        self.show_all()
示例#8
0
    def _build_interface(self):
        self.vbox = gtk.VBox()
        self.vbox.set_spacing(6)

        self.vbox_top = gtk.VBox()
        self.vbox_top.set_spacing(0)
        self.list = common.list_view_new_icon_and_text(headers=['', _('Drive'), _('Mapping')], number_of_text_columns=2, select_multiple=False)
        self.vbox_top.pack_start(self.list, True, True)
        self.hbox_buttons = gtk.HBox()
        self.hbox_buttons.set_spacing(6)
        self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
        self.button_add.set_sensitive(True)
        self.hbox_buttons.pack_start(self.button_add, False, False)
        self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE)
        self.button_remove.set_sensitive(False)
        self.hbox_buttons.pack_start(self.button_remove, False, False)
        self.button_auto = common.button_new_with_image('gtk-refresh', label=_("Autodetect"), use_underline=False)
        self.hbox_buttons.pack_end(self.button_auto, False, False)
        self.vbox_top.pack_start(self.hbox_buttons, False, False)
        self.vbox.pack_start(self.vbox_top, True, True)

        self.vbox_bottom = gtk.VBox()
        self.vbox_bottom.set_spacing(6)
        self.path_entry = gtk.Entry()
        self.path_button = gtk.Button(_('Browse...'))
        self.path_box = common.new_label_with_widget('%s: ' % _('Path'), [
            self.path_entry, self.path_button
        ])
        self.vbox_bottom.pack_start(self.path_box, False, True)

        #self.expander = gtk.Expander(_('Advanced'))
        #self.vbox_bottom.pack_start(self.expander, False, True)
        self.vbox_expander = gtk.VBox()
        self.vbox_expander.set_spacing(6)
        #self.expander.add(self.vbox_expander)
        self.vbox_bottom.pack_start(self.vbox_expander, False, True)

        self.device_entry = gtk.Entry()
        self.device_button = gtk.Button(_('Browse...'))
        self.device_box = common.new_label_with_widget('%s: ' % _('Device'), [
            self.device_entry, self.device_button
        ])
        self.vbox_expander.pack_start(self.device_box, False, True)

        self.hbox_toggle = gtk.HBox()
        self.device_toggle = gtk.CheckButton(_('Use device file for path'))
        self.hbox_toggle.pack_end(self.device_toggle, False, True)
        self.vbox_expander.pack_start(self.hbox_toggle, False, True)

        self.type = gtk.combo_box_new_text()
        for d_type,d_name in self.DRIVE_TYPES:
            self.type.append_text(d_name)
        self.type_box = common.new_label_with_widget('%s: ' % _('Type'), self.type)
        self.vbox_bottom.pack_start(self.type_box, False, True)
        self.vbox.pack_start(self.vbox_bottom, False, True)

        self.list.connect('changed', self.list_changed)
        self.button_add.connect('clicked', self.button_add_clicked)
        self.button_remove.connect('clicked', self.button_remove_clicked)
        self.button_auto.connect('clicked', self.button_auto_clicked)
        self.path_entry.connect('changed', self.path_changed)
        self.path_button.connect('clicked', self.button_path_clicked)
        self.type.connect('changed', self.type_changed)
        self.device_entry.connect('changed', self.device_changed)
        self.device_button.connect('clicked', self.button_device_clicked)
        self.device_toggle.connect_after('toggled', self.device_toggled)

        self.list.renderers[1].connect('edited', self.drive_letter_edit)
        self.list.renderers[1].set_property('editable', True)

        self.list.renderers[2].connect('edited', self.drive_mapping_edit)
        self.list.renderers[2].set_property('editable', True)

        self.frame = common.frame_wrap(self.vbox, self.title)
        self.pack_start(self.frame, True, True)

        self.sizable = [self.path_box.widget, self.type]

        self.show_all()
        self.hbox_toggle.hide()

        self.filechooserdialog_path = common.filechooserdialog_new_with_filters(
            title = _('Select which folder the drive should be mapped to'),
            parent = common.widget_get_top_parent(self),
            action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
            on_response_func = self.path_dialog_response)

        self.filechooserdialog_device = common.filechooserdialog_new_with_filters(
            title = _('Select which device file the drive use'),
            parent = common.widget_get_top_parent(self),
            action = gtk.FILE_CHOOSER_ACTION_OPEN,
            on_response_func = self.device_dialog_response)
示例#9
0
    def _build_interface(self):
        self.vbox = gtk.VBox()
        self.vbox.set_spacing(6)

        self.vbox_top = gtk.VBox()
        self.vbox_top.set_spacing(0)
        self.list = common.list_view_new_icon_and_text(
            headers=['', _('Drive'), _('Mapping')],
            number_of_text_columns=2,
            select_multiple=False)
        self.vbox_top.pack_start(self.list, True, True)
        self.hbox_buttons = gtk.HBox()
        self.hbox_buttons.set_spacing(6)
        self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
        self.button_add.set_sensitive(True)
        self.hbox_buttons.pack_start(self.button_add, False, False)
        self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE)
        self.button_remove.set_sensitive(False)
        self.hbox_buttons.pack_start(self.button_remove, False, False)
        self.button_auto = common.button_new_with_image('gtk-refresh',
                                                        label=_("Autodetect"),
                                                        use_underline=False)
        self.hbox_buttons.pack_end(self.button_auto, False, False)
        self.vbox_top.pack_start(self.hbox_buttons, False, False)
        self.vbox.pack_start(self.vbox_top, True, True)

        self.vbox_bottom = gtk.VBox()
        self.vbox_bottom.set_spacing(6)
        self.path_entry = gtk.Entry()
        self.path_button = gtk.Button(_('Browse...'))
        self.path_box = common.new_label_with_widget(
            '%s: ' % _('Path'), [self.path_entry, self.path_button])
        self.vbox_bottom.pack_start(self.path_box, False, True)

        #self.expander = gtk.Expander(_('Advanced'))
        #self.vbox_bottom.pack_start(self.expander, False, True)
        self.vbox_expander = gtk.VBox()
        self.vbox_expander.set_spacing(6)
        #self.expander.add(self.vbox_expander)
        self.vbox_bottom.pack_start(self.vbox_expander, False, True)

        self.device_entry = gtk.Entry()
        self.device_button = gtk.Button(_('Browse...'))
        self.device_box = common.new_label_with_widget(
            '%s: ' % _('Device'), [self.device_entry, self.device_button])
        self.vbox_expander.pack_start(self.device_box, False, True)

        self.hbox_toggle = gtk.HBox()
        self.device_toggle = gtk.CheckButton(_('Use device file for path'))
        self.hbox_toggle.pack_end(self.device_toggle, False, True)
        self.vbox_expander.pack_start(self.hbox_toggle, False, True)

        self.type = gtk.combo_box_new_text()
        for d_type, d_name in self.DRIVE_TYPES:
            self.type.append_text(d_name)
        self.type_box = common.new_label_with_widget('%s: ' % _('Type'),
                                                     self.type)
        self.vbox_bottom.pack_start(self.type_box, False, True)
        self.vbox.pack_start(self.vbox_bottom, False, True)

        self.list.connect('changed', self.list_changed)
        self.button_add.connect('clicked', self.button_add_clicked)
        self.button_remove.connect('clicked', self.button_remove_clicked)
        self.button_auto.connect('clicked', self.button_auto_clicked)
        self.path_entry.connect('changed', self.path_changed)
        self.path_button.connect('clicked', self.button_path_clicked)
        self.type.connect('changed', self.type_changed)
        self.device_entry.connect('changed', self.device_changed)
        self.device_button.connect('clicked', self.button_device_clicked)
        self.device_toggle.connect_after('toggled', self.device_toggled)

        self.list.renderers[1].connect('edited', self.drive_letter_edit)
        self.list.renderers[1].set_property('editable', True)

        self.list.renderers[2].connect('edited', self.drive_mapping_edit)
        self.list.renderers[2].set_property('editable', True)

        self.frame = common.frame_wrap(self.vbox, self.title)
        self.pack_start(self.frame, True, True)

        self.sizable = [self.path_box.widget, self.type]

        self.show_all()
        self.hbox_toggle.hide()

        self.filechooserdialog_path = common.filechooserdialog_new_with_filters(
            title=_('Select which folder the drive should be mapped to'),
            parent=common.widget_get_top_parent(self),
            action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
            on_response_func=self.path_dialog_response)

        self.filechooserdialog_device = common.filechooserdialog_new_with_filters(
            title=_('Select which device file the drive use'),
            parent=common.widget_get_top_parent(self),
            action=gtk.FILE_CHOOSER_ACTION_OPEN,
            on_response_func=self.device_dialog_response)