예제 #1
0
    def _setup_page_remaster(self):
        self.background = gtk.FileChooserButton(
            gtk.FileChooserDialog(_('Background'),
                                  parent=self.assistant,
                                  action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                  buttons=(gtk.STOCK_CANCEL,
                                           gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
                                           gtk.RESPONSE_OK)))
        self.background.set_current_folder(os.curdir)
        filter = gtk.FileFilter()
        filter.add_pattern('*.jpg')
        self.background.set_filter(filter)

        self.save = gtk.FileChooserButton(
            gtk.FileChooserDialog(
                _('Save'),
                parent=self.assistant,
                action=gtk.FILE_CHOOSER_ACTION_SAVE | gtk.FILE_C,
                buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE,
                         gtk.RESPONSE_OK)))
        self.save.set_current_folder(os.curdir)

        table = gtk.Table(2, 2)
        label = gtk.Label(_('Background:'))
        label.set_alignment(1, 0.5)
        table.attach(label,
                     0,
                     1,
                     0,
                     1,
                     xoptions=gtk.FILL,
                     xpadding=5,
                     ypadding=2)
        table.attach(self.background, 1, 2, 0, 1, ypadding=2)
        label = gtk.Label(_('Save:'))
        label.set_alignment(1, 0.5)
        table.attach(label,
                     0,
                     1,
                     1,
                     2,
                     xoptions=gtk.FILL,
                     xpadding=5,
                     ypadding=2)
        table.attach(self.save, 1, 2, 1, 2, ypadding=2)

        box = gtk.VBox()
        box.pack_start(table, False, False, 5)

        self.remaster = gtk.Alignment(1, 1, 1, 1)
        self.remaster.add(box)
        self.remaster.set_padding(5, 5, 5, 5)

        self.assistant.append_page(self.remaster)
        self.assistant.set_page_title(self.remaster, _('Remaster'))
        self.assistant.set_page_complete(self.remaster, True)
        self.assistant.set_page_type(self.remaster, gtk.ASSISTANT_PAGE_CONFIRM)
예제 #2
0
 def action_copyto(self, widget):
     selection = self.trview.get_selection()
     model, selected = selection.get_selected_rows()
     iters = [model.get_iter(path) for path in selected]
     if iters:
         d = gtk.Dialog(parent=self.win,
                        title='Select destination directory',
                        buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
                                 gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
         fcd = gtk.FileChooserButton('Select destination directory')
         fcd.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
         d.vbox.pack_start(fcd, padding=2)
         d.show_all()
         ret = d.run()
         if ret == gtk.RESPONSE_OK:
             dest = fcd.get_current_folder()
             if os.path.exists(dest):
                 for i in iters:
                     fname = model.get_value(i, 1)
                     absf = self.curdir + os.path.sep + fname
                     if os.path.isdir(absf):
                         distutils.dir_util.copy_tree(absf, dest)
                     else:
                         shutil.copy(absf, dest)
             else:
                 d2 = gtk.MessageDialog(parent=self.win,
                                        type=gtk.MESSAGE_ERROR,
                                        buttons=gtk.BUTTONS_OK,
                                        message_format='''
                         Destination directory does not exists!''')
                 d2.run()
                 d2.destroy()
         d.destroy()
예제 #3
0
    def _init_graph_select(self):
        #fill graph list
        store = gtk.ListStore(gobject.TYPE_PYOBJECT, str)
        cell = gtk.CellRendererText()
        self._w("graph_select").pack_start(cell, True)
        self._w("graph_select").add_attribute(cell, 'text', 1)
        self._w("graph_select").set_model(store)

        for graph in self._chart:
            store.set(store.append(None), 0, graph, 1, graph.get_title())

        self._w("graph_select").set_active(0)
        self._cb_graph_changed(self._w("graph_select"))

        self._datapoint_chooser = gtk.FileChooserButton(
            "Choose datapoint graphic")
        self._datapoint_chooser.set_sensitive(False)
        self._w("table8").attach(self._datapoint_chooser,
                                 1,
                                 2,
                                 3,
                                 4,
                                 yoptions=gtk.FILL,
                                 xoptions=gtk.FILL | gtk.EXPAND)

        cell = gtk.CellRendererText()
        self._w("graph_fill_graph").pack_start(cell, True)
        self._w("graph_fill_graph").add_attribute(cell, 'text', 1)
예제 #4
0
파일: util.py 프로젝트: dead-beef/pietdbg
    def __init__(self, cfg):
        gtk.Dialog.__init__(self, 'Preferences', None, gtk.DIALOG_MODAL,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_OK, gtk.RESPONSE_OK))
        self.set_default_size(0, 0)

        self.cfg = copy(cfg)

        file_chooser = gtk.FileChooserButton('Select interpreter path')
        file_chooser.connect('file_set', self.set_file)

        table = gtk.Table(6, 2)

        l = gtk.Label('Interpreter path')
        l.set_alignment(0, 0)
        table.attach(l, 0, 1, 0, 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
        table.attach(file_chooser, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

        row = 1
        for cl in self.colors:
            l = gtk.Label(cl[1])
            l.set_alignment(0, 0)
            table.attach(l, 0, 1, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

            l = gtk.ColorButton(
                gtk.gdk.color_parse(self.cfg.get('config', cl[0])))
            l.connect('color-set', self.set_color, cl[0])
            table.attach(l, 1, 2, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

            row += 1

        self.get_content_area().pack_start(table, expand=False, fill=False)
예제 #5
0
    def __init__(self):
        gobject.GObject.__init__(self)
        self.Widgets = []
        self.ElementButton = gtk.Button("H")
        self.Widgets.append(self.ElementButton)
        self.Widgets.append (gtk.Label("1"))
        self.combo = gtk.combo_box_new_text()
        self.combo.append_text("Coulomb")
#        self.combo.append_text("Local PP")
        self.combo.append_text("Nonlocal PP")
        self.combo.set_active(0)
        self.combo.connect ("changed", self.combo_callback)
        self.Widgets.append (self.combo)
        # Setup PP file chooser
        filter = gtk.FileFilter()
        filter.add_pattern("*.xml")
        filter.set_name ("XML files")
        buttons = (gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_ACCEPT)
        self.FileDialog = gtk.FileChooserDialog("Select PP file", buttons=buttons)
        self.FileDialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
        self.FileDialog.connect("response", self.pp_chosen_callback)
        self.FileButton = gtk.FileChooserButton(self.FileDialog)
        self.FileButton.add_filter(filter)
        self.FileButton.set_sensitive(False)
        self.FileButton.set_action (gtk.FILE_CHOOSER_ACTION_OPEN)
        self.Widgets.append (self.FileButton)
        # Add "Remove" button
        removeButton = gtk.Button("Remove")
        self.Charge = 1
        self.Widgets.append (removeButton)
예제 #6
0
파일: app.py 프로젝트: cristivlas/zerobugs
    def __init_file_open(self, toolbar):
        try:
            self.__fileDialog = gtk.FileChooserDialog()
            self.__fileDialog.connect("close", self.__on_filechooser_close)
            self.__fileDialog.connect("unmap-event", self.__on_unmap_event)

            self.__fileButton = gtk.FileChooserButton(self.__fileDialog)
            self.__fileButton.set_width_chars(6)

            #connect the widget with the class that implements the logic
            self.__fileOpen = dlg.FileOpen(
                self.__fileDialog, [ffilter.ELF(self, gtk.FileFilter())])

            #wrap FileChooserButton in a ToolItem
            item = gtk.ToolItem()
            item.add(self.__fileButton)
            item.show_all()
            toolbar.insert(item, 0)

        except:
            #FileChooser is available n Pygtk 2.4 and newer;
            # fallback to FileSelection if not available
            self.__fileButton = None
            self.__fileDialog = gtk.FileSelection()
            self.__fileDialog.hide_fileop_buttons()
            #connect the widget with the class that implements the logic
            self.__fileOpen = dlg.FileOpen(self.__fileDialog,
                                           [ffilter.ELF(self, None)])
예제 #7
0
    def __init__(self):

        self.out_folder = gtk.FileChooserButton(_("Select Folder"))
        self.out_folder.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        self.out_folder.set_current_folder(os.path.expanduser("~") + "/")
        gui.render_out_folder = self.out_folder
        out_folder_row = guiutils.get_two_column_box(gtk.Label(_("Folder:")),
                                                     self.out_folder, 60)

        self.movie_name = gtk.Entry()
        self.movie_name.set_text("movie")
        self.extension_label = gtk.Label()

        name_box = gtk.HBox(False, 8)
        name_box.pack_start(self.movie_name, True, True, 0)
        name_box.pack_start(self.extension_label, False, False, 0)

        movie_name_row = guiutils.get_two_column_box(gtk.Label(_("Name:")),
                                                     name_box, 60)

        self.vbox = gtk.VBox(False, 2)
        self.vbox.pack_start(out_folder_row, False, False, 0)
        self.vbox.pack_start(movie_name_row, False, False, 0)

        self.out_folder.set_tooltip_text(
            _("Select folder to place rendered file in"))
        self.movie_name.set_tooltip_text(_("Give name for rendered file"))
예제 #8
0
    def __init__(self, session):
        """constructor
        """
        BaseTable.__init__(self, 3, 2)
        self.set_border_width(5)
        self.session = session

        self.append_markup('<b>' + _('File transfers') + '</b>')
        self.append_check(_('Sort received files by sender'),
                          'session.config.b_download_folder_per_account')
        self.add_text(_('Save files to:'), 0, 2, True)

        def on_path_selected(f_chooser):
            ''' updates the download dir config value '''
            if f_chooser.get_filename() != self.session.config.download_folder:
                self.session.config.download_folder = f_chooser.get_filename()

        path_chooser = gtk.FileChooserDialog(
            title=_('Choose a Directory'),
            action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
                     gtk.RESPONSE_OK))
        fc_button = gtk.FileChooserButton(path_chooser)
        fc_button.set_current_folder(self.session.config.get_or_set("download_folder", \
                e3.common.locations.downloads()))
        path_chooser.connect('selection-changed', on_path_selected)
        self.attach(fc_button, 2, 3, 2, 3, gtk.EXPAND | gtk.FILL, 0)
예제 #9
0
 def addExpander(self, name, *choices, **kwargs):
     options = {}
     group = gtk.ToolItemGroup(name)
     self.add(group)
     group.set_collapsed(True)
     item = gtk.ToolItem()
     group.insert(item, -1)
     group.child_set_property(item, 'new-row', False)
     group.child_set_property(item, 'expand', False)
     table = gtk.Table()
     table.resize(len(choices), 2)
     table.set_homogeneous(True)
     item.add(table)
     radio_group = None
     for i, (choice, mode) in enumerate(choices):
         entry = None
         radio = gtk.RadioButton(group=radio_group, label=choice)
         if not mode:
             table.attach(radio, 0, 2, i, i + 1)
         else:
             if mode == 'entry':
                 entry = gtk.Entry()
             else:
                 entry = gtk.FileChooserButton('Select a file...')
             table.attach(radio, 0, 1, i, i + 1)
             table.attach(entry, 1, 2, i, i + 1)
         options[choice] = entry
         if not radio_group:
             radio_group = radio
     self.show_all()
     self.__groups[name] = radio_group, options
     if 'expanded' in kwargs:
         group.set_collapsed(not kwargs['expanded'])
     return group
예제 #10
0
    def __init__(self, geometry):
        self.Geometry = geometry
        gtk.Frame.__init__(self, "Orbitals")

        # Setup orbital HDF5 file chooser
        filter = gtk.FileFilter()
        filter.add_pattern("*.h5")
        filter.set_name ("XML files")
        buttons = (gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,\
                   gtk.STOCK_OPEN,gtk.RESPONSE_ACCEPT)
        self.FileDialog = gtk.FileChooserDialog \
            ("Select orbital file", buttons=buttons)
        self.FileDialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
        self.FileDialog.connect("response", self.h5_chosen_callback)
        self.FileButton = gtk.FileChooserButton(self.FileDialog)
        self.FileButton.add_filter(filter)
        self.FileButton.set_sensitive(True)
        self.FileButton.set_action (gtk.FILE_CHOOSER_ACTION_OPEN)
        filebox = gtk.HBox(True)
        vbox = gtk.VBox(True)
        self.TileFrame = TilingMatrix()
        filebox.pack_start(self.FileButton, True, False)
        filebox.pack_start(self.TileFrame , True, False)

        self.add(filebox)
예제 #11
0
        def add_parser(label_parser,
                       label_file,
                       chooser_title,
                       field_label_parser,
                       field_label_file,
                       i_row,
                       self=self):
            table.attach(gtk.Label(label_parser), 0, 1, i_row, i_row + 1)
            parser_combo = gtk.combo_box_new_text()
            table.attach(parser_combo, 1, 2, i_row, i_row + 1)
            for parser in self.get_parser_list():
                parser_combo.append_text(parser)
            parser_combo.set_active(0)
            fields[field_label_parser] = parser_combo

            table.attach(gtk.Label(label_file), 0, 1, i_row + 1, i_row + 2)
            filename_chooser = gtk.FileChooserButton(chooser_title)
            table.attach(filename_chooser, 1, 2, i_row + 1, i_row + 2)
            fields[field_label_file] = filename_chooser

            def on_combo_changed(widget, chooser=filename_chooser, self=self):
                if self.get_parser_by_index(
                        widget.get_active()).path_is_folder:
                    chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
                else:
                    chooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)

            parser_combo.connect("changed", on_combo_changed)
예제 #12
0
    def main():
        # file filters used with the filechoosers
        filter = gtk.FileFilter()
        filter.set_name("Images")
        filter.add_mime_type("image/png")
        filter.add_mime_type("image/jpeg")
        filter.add_mime_type("image/gif")
        filter.add_pattern("*.png")
        filter.add_pattern("*.jpg")
        filter.add_pattern("*.gif")
        filter.add_pattern("*.tif")
        filter.add_pattern("*.xpm")
        all_filter = gtk.FileFilter()
        all_filter.set_name("All files")
        all_filter.add_pattern("*")

        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title("Native Filechooser")

        window.connect("destroy", lambda wid: gtk.main_quit())
        window.connect("delete_event", lambda e1, e2: gtk.main_quit())

        button_open = gtk.FileChooserButton("Open File")
        button_open.add_filter(filter)
        button_open.add_filter(all_filter)
        button_open.connect("selection-changed", on_file_selected)

        window.add(button_open)
        window.show_all()
예제 #13
0
 def _fsel(self, label, action):
     fsel = gtk.FileChooserButton(label)
     # Hatari cannot access URIs
     fsel.set_local_only(True)
     fsel.set_width_chars(12)
     fsel.set_action(action)
     return fsel
예제 #14
0
 def addScheduleWidget(self):
     self.filechooser = gtk.FileChooserButton("Upload a schedule")
     self.filechooser.set_local_only(True)
     self.filechooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
     filefilter = gtk.FileFilter()
     filefilter.add_pattern("*.ics")
     filefilter.set_name("vCalendar files")
     self.filechooser.add_filter(filefilter)
     self.filechooser.show()
     scheduleButton = gtk.Button("Schedule recordings")
     scheduleButton.show()
     scheduleButton.connect("clicked", self.cb_schedule_recordings)
     self.widget.attach(scheduleButton,
                        0,
                        1,
                        1,
                        2,
                        xoptions=0,
                        yoptions=0,
                        xpadding=6,
                        ypadding=6)
     self.widget.attach(self.filechooser,
                        1,
                        2,
                        1,
                        2,
                        xoptions=gtk.EXPAND | gtk.FILL,
                        yoptions=0,
                        xpadding=6,
                        ypadding=6)
예제 #15
0
    def __addFilenameItem(self, value=''):
        # Create new hbox
        hbox = gtk.HBox(False, 5)

        # Add label to hbox
        lLabel = gtk.Label('-f')
        lLabel.set_property('width-request', 50)
        lLabel.set_property('xalign', 0)
        lLabel.show()
        hbox.pack_start(lLabel, False)

        # Add entry field to hbox
        fFilename = gtk.FileChooserButton('File for -sc items')
        fFilename.set_filename(value)
        fFilename.connect('file-set', self.on_formitem_changed)
        fFilename.show()
        hbox.pack_start(fFilename)

        # Add remove button to hbox
        bRemove = gtk.Button('X')
        bRemove.connect('clicked', self.on_remove_item, self.__vboxFilename,
                        hbox)
        bRemove.show()
        hbox.pack_start(bRemove, False)

        # Show hbox
        hbox.show()

        self.__vboxFilename.add(hbox)

        # Focus file field
        if not value: fFilename.grab_focus()
예제 #16
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)
예제 #17
0
    def CreateGeneralOptionSelector(self,
                                    vbox,
                                    labelText,
                                    varName,
                                    folderSelect=False):
        hbox = gtk.HBox()
        hbox.set_spacing(15)
        hbox.pack_start(gtk.Label(''), False)
        label = gtk.Label(labelText)
        label.set_width_chars(13)
        chooser = gtk.FileChooserButton(labelText)
        if folderSelect:
            chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
            chooser.connect('selection-changed',
                            self.filechooser_folder_changed, varName)
        else:
            chooser.connect('file-set', self.filechooser_changed, varName)

        saved_path = self.configuration['settings'][varName]
        if saved_path:
            chooser.connect('file-activated', self.file_selected, saved_path)
            chooser.emit('file-activated')

        hbox.pack_start(label, False)
        hbox.pack_start(chooser)
        hbox.pack_start(gtk.Label(''), False)
        vbox.pack_start(hbox, False)
예제 #18
0
    def __init__(self):
        win = gtk.Window()

        self.manager = ClientThreadManager.ClientThreadManager(3)
        win.connect("delete_event", self.quit)
        box = gtk.VBox(False, 3)
        win.add(box)
        controlButtons = gtk.HBox(False, 10)
        self.metaWatcherButton = gtk.ToggleButton('Watch queue')
        self.metaWatcherButton.connect('clicked',
                                       self.metaWatcherButton_clicked)

        self.cueButton = gtk.ToggleButton('CUE')
        self.cueButton.connect('clicked', self.cueButton_clicked)

        self.skipButton = gtk.Button('Skip')
        self.skipButton.connect('clicked', self.skip_clicked)

        #	self.remainInfo=gtk.Label(" ")
        #	self.remain=None
        self.remainInfo = countdownBox(self)

        self.addButton = addButton = gtk.FileChooserButton('')
        fileFilter = gtk.FileFilter()
        fileFilter.set_name("Audio MP3/OGG")
        fileFilter.add_pattern("*.mp3")
        fileFilter.add_pattern("*.ogg")
        addButton.add_filter(fileFilter)
        addButton.connect("selection-changed", self.cue_file)

        self.metaWatcherModel = gtk.ListStore(gobject.TYPE_STRING,
                                              gobject.TYPE_STRING,
                                              gobject.TYPE_STRING)
        metaWatcherView = gtk.TreeView(self.metaWatcherModel)
        metaWatcherView.set_size_request(400, 200)
        cols = ['Artist', 'Title', 'Status']
        i = 0
        for col in cols:
            metaWatcherView.append_column(
                gtk.TreeViewColumn(col, gtk.CellRendererText(), text=i))
            i = i + 1

        controlButtons.pack_start(self.metaWatcherButton, False)
        controlButtons.pack_start(self.cueButton, False)
        controlButtons.pack_start(self.skipButton, False)
        controlButtons.pack_start(self.remainInfo, False)

        box.pack_start(controlButtons, False)
        box.pack_start(self.addButton, False)
        box.pack_start(metaWatcherView)

        self.manager.make_commandWatcher(
            'mixer_main.status 0', self.cueButton_daemon,
            self.deactive_cueButton,
            '.*?(?:[a-z][a-z]+).*?(?:[a-z][a-z]+).*?(?:[a-z][a-z]+).*?((?:[a-z][a-z]+))'
        )

        win.show_all()
        gtk.main()
예제 #19
0
 def __init__(self, parent):
     chooser = gtk.FileChooserButton('Select a File')
     chooser.set_local_only(True)  # Hatari cannot access URIs
     chooser.set_width_chars(12)
     table, self.dialog = create_table_dialog(parent, "Load to memory", 2, 2)
     self.file = table_add_widget_row(table, 0, "File name:", chooser)
     self.address = table_add_entry_row(table, 1, "Load address:", 6)
     self.address.connect("activate", dialog_apply_cb, self.dialog)
예제 #20
0
 def add_chooser(self, box):
     hbox_csv_import = gtk.HBox()
     box.pack_start(hbox_csv_import, False, True, 4)
     label_csv_import = gtk.Label(_("File to Import:"))
     hbox_csv_import.pack_start(label_csv_import, False, False, 0)
     self.import_csv_file = gtk.FileChooserButton(_("Open..."))
     label_csv_import.set_mnemonic_widget(self.import_csv_file)
     hbox_csv_import.pack_start(self.import_csv_file, True, True, 0)
예제 #21
0
 def get_datasource_options_widgets(cls, data_widgets, initial_data=None):
     lbl = gtk.Label(_(u"Log file:"))
     lbl.set_alignment(0, 0.5)
     file_chooser = gtk.FileChooserButton(_(u"Select HTTP log file"))
     if initial_data:
         file_chooser.select_filename(initial_data.options.get("log_file"))
     data_widgets["log_file"] = (cls._get_filename, file_chooser)
     return data_widgets, [lbl, file_chooser]
예제 #22
0
 def _build_widget(self):
     self.widget = gtk.FileChooserButton(self.title)
     self.widget.props.local_only = not Vfs.backend_supports_remote_uri_schemes(
     )
     self.widget.connect("selection-changed", self._selection_changed)
     if self.directory:
         self.widget.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
     else:
         self.widget.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
예제 #23
0
    def create_configure_dialog(self):
        dialog = gtk.Dialog("Markup preview Configuration")
        dialog.set_default_size(300, 200)

        button_bar = gtk.HButtonBox()
        button_bar.set_layout(gtk.BUTTONBOX_END)

        cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
        ok_button = gtk.Button(stock=gtk.STOCK_OK)

        display_in_side_panel_checkbox = gtk.CheckButton(
            "Afficher dans le panneau latéral")
        display_in_side_panel_checkbox.set_active(self.display_in_side_panel)

        css_path_file_chooser = gtk.FileChooserButton("CSS path")
        css_path_label = gtk.Label("CSS path:")
        css_path_box = gtk.HBox()
        css_path_box.pack_start(css_path_label)
        css_path_box.pack_start(css_path_file_chooser)
        css_path_box.child_set_property(css_path_label, "fill", False)
        css_path_box.child_set_property(css_path_label, "expand", False)

        if self.css_path is not None:
            css_path_file_chooser.set_filename(self.css_path)

        button_bar.pack_start(cancel_button)
        button_bar.pack_start(ok_button)

        dialog.vbox.pack_start(display_in_side_panel_checkbox)
        dialog.vbox.child_set_property(display_in_side_panel_checkbox,
                                       "padding", 5)

        dialog.vbox.pack_start(css_path_box)
        dialog.vbox.child_set_property(css_path_box, "padding", 5)
        dialog.vbox.child_set_property(css_path_box, "expand", False)

        dialog.vbox.pack_start(button_bar)
        dialog.vbox.child_set_property(button_bar, "expand", False)

        def cancel_config(button):
            dialog.destroy()

        def valid_config(button):
            self.display_in_side_panel = display_in_side_panel_checkbox.get_active(
            )
            self.css_path = css_path_file_chooser.get_filename()
            dialog.destroy()
            self.save_config()
            self.generate_preview_panel()

        cancel_button.connect("clicked", cancel_config)
        ok_button.connect("clicked", valid_config)

        dialog.vbox.show_all()

        return dialog
예제 #24
0
    def create_filechooser_buttons(self):
        try:
            self.builder.get_object("eventbox1").get_child().destroy()
        except AttributeError:
            pass
        finally:
            filechooserbutton = gtk.FileChooserButton('Select a File')
            filechooserbutton.connect("file-set", self.allow_convert)
            self.builder.get_object("eventbox1").add(filechooserbutton)
            filechooserbutton.show()

        try:
            self.builder.get_object("eventbox2").get_child().destroy()
        except AttributeError:
            pass
        finally:
            filechooserbutton = gtk.FileChooserButton('Select a File')
            filechooserbutton.connect("file-set", self.allow_spin)
            filechooserbutton.set_sensitive(False)
            self.builder.get_object("eventbox2").add(filechooserbutton)
            filechooserbutton.show()

        try:
            self.builder.get_object("eventbox3").get_child().destroy()
        except AttributeError:
            pass
        finally:
            filechooserbutton = gtk.FileChooserButton('Select a Folder')
            filechooserbutton.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
            filechooserbutton.set_sensitive(False)
            self.builder.get_object("eventbox3").add(filechooserbutton)
            filechooserbutton.show()

        self.builder.get_object("button1").set_sensitive(False)
        self.builder.get_object("hbox1").set_sensitive(False)
        self.builder.get_object("checkbutton1").set_sensitive(False)
        self.builder.get_object("checkbutton2").set_sensitive(False)
        self.builder.get_object("checkbutton1").set_active(False)
        self.builder.get_object("checkbutton2").set_active(False)
        self.builder.get_object("spinbutton1").set_value(0)
        self.builder.get_object("label7").set_text("")
        self.builder.get_object("eventbox3").get_child().set_filename(
            os.getenv('USERPROFILE') or os.getenv('HOME'))
예제 #25
0
파일: btn4ws.py 프로젝트: obuglas/mytools
    def _addPathSelectionPage(self):
        page = gtk.VBox(False, 5)
        self.pages["pathselection"] = page
        page.set_border_width(5)
        page.show()
        self.append_page(page)
        self.set_page_title(page, "Select the input file and output directory")
        self.set_page_type(page, gtk.ASSISTANT_PAGE_CONTENT)

        label = gtk.Label(
            "Please choose the file containing your button labels and the directory where the generated files should be put."
        )
        label.set_line_wrap(True)
        label.show()
        page.pack_start(label, True, True, 0)

        table = gtk.Table(rows=2, columns=2, homogeneous=False)
        table.show()
        label = gtk.Label("Button label file")
        label.show()
        table.attach(label, 0, 1, 0, 1)
        button = gtk.FileChooserButton("Choose file")
        button.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
        if self.data["filename"]:
            button.set_filename(self.data["filename"])
        button.connect("selection-changed", self._cb_file_selected)
        button.show()
        table.attach(button, 1, 2, 0, 1)

        label = gtk.Label("Output directory")
        label.show()
        table.attach(label, 0, 1, 1, 2)
        button = gtk.FileChooserButton("Choose directory")
        button.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        if self.data["outdir"]:
            button.set_filename(self.data["outdir"])
        else:
            self.data["outdir"] = button.get_filename()
        button.connect("selection-changed", self._cb_dir_selected)
        button.show()
        table.attach(button, 1, 2, 1, 2)

        page.pack_end(table)
예제 #26
0
 def generate_widget(self, value):
     """Generate a special widget for file options"""
     dlg = self.generate_file_opener()
     self.widget = gtk.FileChooserButton(dlg)
     self.widget.set_title(self._opener_title)
     self.widget.set_size_request(180, 28)
     self.set_value(value)
     if self.realtime:
         self.widget.connect("selection-changed", self.has_changed)
     return self.widget
예제 #27
0
    def __add_page_intro(self):
        # First page
        vbox = gtk.VBox(False, 4)
        vbox.set_border_width(4)

        label = gtk.Label(
            "\nThis assistant will help you generate a new M3 project using the new CMake integration.\nIn the following page, you will get to specify the components that you need to create.\n"
        )
        label.set_line_wrap(True)
        vbox.pack_start(label, True, True, 0)

        table = gtk.Table(4, 2, True)
        table.set_row_spacings(4)
        table.set_col_spacings(4)

        # Author
        label = gtk.Label("Author :")
        table.attach(label, 0, 1, 0, 1)
        self.author_entry = gtk.Entry()
        self.author_entry.set_text(get_username())
        table.attach(self.author_entry, 1, 2, 0, 1)

        # Project name # should be m3ens, m3uta etc
        label = gtk.Label("Project Name :")
        table.attach(label, 0, 1, 1, 2)
        self.entry = gtk.Entry()
        self.entry.set_text("m3project")
        table.attach(self.entry, 1, 2, 1, 2)
        self.entry.connect('changed', self.changed_comp_name_cb)

        # Component name
        label = gtk.Label("Components Name :")
        table.attach(label, 0, 1, 2, 3)
        self.entry_comp_folder = gtk.Entry()
        self.entry_comp_folder.set_text("mycomponent")
        table.attach(self.entry_comp_folder, 1, 2, 2, 3)
        self.entry_comp_folder.connect('changed', self.changed_comp_name_cb)

        vbox.pack_start(table, True, False, 0)

        # File chooser
        table.attach(gtk.Label("Root folder :"), 0, 1, 3, 4)
        #table.attach(gtk.Label(""), 0, 3, 3, 4)
        self.file_chooser = gtk.FileChooserButton('Select a folder')
        home = get_home_dir()
        self.file_chooser.set_filename(home)
        self.file_chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        table.attach(self.file_chooser, 1, 2, 3, 4)
        vbox.show_all()

        self.append_page(vbox)
        self.set_page_title(vbox, 'M3 CMake Project Creator')
        self.set_page_type(vbox, gtk.ASSISTANT_PAGE_CONTENT)

        self.set_page_complete(vbox, True)
예제 #28
0
    def init_dialog(self, table=None):
        table = gtk.Table(rows=3, columns=2)
        table.attach(gtk.Label("Bibliography Name"), 0, 1, 0, 1)
        self.bibtexNameEntry = gtk.Entry()
        table.attach(self.bibtexNameEntry, 1, 2, 0, 1)
        table.attach(gtk.Label("Path to bibtex (*.bib) file:"), 0, 1, 1, 2)
        self.bibtexPathEntry = gtk.FileChooserButton('Select a bibtex file')

        filter = gtk.FileFilter()
        filter.add_pattern("*.bib")

        self.bibtexPathEntry.set_filter(filter)
        table.attach(self.bibtexPathEntry, 1, 2, 1, 2)

        table.attach(gtk.Label("File Directory (PDFs)"), 0, 1, 2, 3)
        self.fileDirEntry = gtk.FileChooserButton(
            'Select the directory containing PDFs')
        self.fileDirEntry.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        table.attach(self.fileDirEntry, 1, 2, 2, 3)
        self.vbox.pack_start(table)
예제 #29
0
    def __init__(self, label, value=False):
        self.table = gtk.Table(rows=2, columns=1)
        self.gtkLabel = gtk.Label((label + ":"))
        self.gtkLabel.set_alignment(xalign=0.0, yalign=0.5)
        self.gtkLabel.show()
        self.table.attach(self.gtkLabel, 0, 1, 0, 1)

        self.dirchooser = gtk.FileChooserButton(_("Choose a directory"))
        self.dirchooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        self.dirchooser.set_filename(os.environ['HOME'])
        self.dirchooser.show()
        self.table.attach(self.dirchooser, 0, 1, 1, 2, xoptions=gtk.FILL)
        self.table.show()
예제 #30
0
파일: ui.py 프로젝트: IL2HorusTeam/minic
    def _build_components(self):
        table = gtk.Table(rows=1, columns=2, homogeneous=False)
        table.set_col_spacings(10)
        self.vbox.pack_start(table, True, True, 0)

        # Server path row ------------------------------------------------------
        label = gtk.Label(_("Server executable"))
        self.server_path = gtk.FileChooserButton(
            _("Select IL-2 FB DS executable"))
        self._add_filter_for_path_selector()

        table.attach(label, 0, 1, 0, 1, gtk.FILL)
        table.attach(self.server_path, 1, 2, 0, 1)