def __create_widgets(self):
        """"""

        self.update_switch_hbox = HIGHBox()
        self.update_settings_hbox = HIGHBox()
        self.update_db_hbox = HIGHBox()

        self.update_switch_section = HIGSectionLabel(_("Update News Detect"))
        self.update_switch_table = HIGTable()
        self.update_settings_section = HIGSectionLabel(_("Update Settings"))
        self.update_settings_table = HIGTable()
        self.update_db_section = HIGSectionLabel(_("Update Database"))
        self.update_db_table = HIGTable()

        self.update_check = gtk.CheckButton(_("Automatically update"))
        self.update_switch_check = gtk.CheckButton(
            _("Software Update Detect Switch"))
        self.update_times_label = HIGEntryLabel(_("Auto detect update news"))
        self.update_method_label = HIGEntryLabel(_("Update method"))

        self.update_time_store = gtk.ListStore(str)
        self.update_time_entry = gtk.ComboBoxEntry(self.update_time_store, 0)
        self.update_method_store = gtk.ListStore(str)
        self.update_method_entry = gtk.ComboBoxEntry(self.update_method_store,
                                                     0)

        self.update_db_label = HIGEntryLabel()
        self.update_db_clear_button = gtk.Button(_("Clear Update Information"))
    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_id = widgets.BasicEntry()
        self.filter_father = widgets.BasicEntry()
        self.filter_mother = widgets.BasicEntry()
        self.filter_child = widgets.BasicEntry()

        self.filter_event = gen.lib.Event()
        self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
        self.etype = gtk.ComboBoxEntry()

        self.family_stub = gen.lib.Family()
        self.family_stub.set_relationship((gen.lib.FamilyRelType.CUSTOM, u''))
        self.rtype = gtk.ComboBoxEntry()

        self.event_menu = widgets.MonitoredDataType(self.etype,
                                                    self.filter_event.set_type,
                                                    self.filter_event.get_type)

        self.rel_menu = widgets.MonitoredDataType(
            self.rtype, self.family_stub.set_relationship,
            self.family_stub.get_relationship)

        self.filter_note = widgets.BasicEntry()

        self.filter_regex = gtk.CheckButton(_('Use regular expressions'))

        self.tag = gtk.ComboBox()
        self.generic = gtk.ComboBox()

        SidebarFilter.__init__(self, dbstate, uistate, "Family")
Пример #3
0
    def initialize_generic_tagging(self):
        """ Initialize all about the generic tag mode """
        # Set Year SpinButton
        self.spinbutton_year = gtk.SpinButton()
        self.spinbutton_year.set_digits(0)
        year = int(time.strftime('%Y',time.localtime()))
        self.spinbutton_year.set_range(year-150,year+20)
        self.spinbutton_year.set_value(year)
        self.spinbutton_year.set_numeric(True)
        self.spinbutton_year.set_increments(1,1)
        self.spinbutton_year.show()
        self.hbox_generic_tag_TYER.pack_start(self.spinbutton_year)
        
        # Set Genre Combobox
        self.genre_model = listmodel.GenreListStore()        
        self.cmbentry_genre = gtk.ComboBoxEntry(self.genre_model,0)
        genre_tooltip = _("Select the genre from the list or type your own")
        self.cmbentry_genre.set_tooltip_markup(genre_tooltip)
        self.cmbentry_genre.show()
        self.hbox_generic_tag_TCON.pack_start(self.cmbentry_genre)
        
        # Set Filename Combobox
        self.filename_model = listmodel.FilenameListStore() 
        self.cmbentry_filename = gtk.ComboBoxEntry(self.filename_model,0)
        filename_tooltip = _("""Modify the <i>mp3</i> filename combining the
frame markups (%artist,%title,%album and %trck) or 
by selecting a preconfigured template from the list bellow""")
        self.cmbentry_filename.set_tooltip_markup(filename_tooltip)
        self.cmbentry_filename.show()
        self.hbox_generic_tag_FILE.pack_start(self.cmbentry_filename)
        
        if self.config["generic-tag"]["active-at-start"]:
            self.on_btn_generic_tag_clicked(self.btn_generic_tag)
Пример #4
0
    def __init__(self):
        super(PostStationDialog, self).__init__()

        title_label = gtk.Label()
        title_label.set_markup("<span font='20.0'>" + _("Post new station") +
                               "</span>")
        self.get_content_area().pack_start(title_label)
        self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)

        table = gtk.Table(3, 8)

        table.attach(gtk.Label(_("Examples")), 2, 3, 0, 1)

        table.attach(gtk.Label(_("Name")), 0, 1, 1, 2)
        self.StationName = gtk.Entry()
        table.attach(self.StationName, 1, 2, 1, 2)
        table.attach(gtk.Label(_("My Station")), 2, 3, 1, 2)

        table.attach(gtk.Label(_("URL")), 0, 1, 2, 3)
        self.StationUrl = gtk.Entry()
        table.attach(self.StationUrl, 1, 2, 2, 3)
        table.attach(gtk.Label(_("http://listen.to.my/station.pls")), 2, 3, 2,
                     3)

        table.attach(gtk.Label(_("Homepage URL")), 0, 1, 3, 4)
        self.StationHomepage = gtk.Entry()
        table.attach(self.StationHomepage, 1, 2, 3, 4)
        table.attach(gtk.Label(_("http://very.cool.site")), 2, 3, 3, 4)

        table.attach(gtk.Label(_("Favicon URL")), 0, 1, 4, 5)
        self.StationFavicon = gtk.Entry()
        table.attach(self.StationFavicon, 1, 2, 4, 5)
        table.attach(gtk.Label(_("http://very.cool.site/favicon.ico")), 2, 3,
                     4, 5)

        table.attach(gtk.Label(_("Country")), 0, 1, 5, 6)
        self.StationCountry = gtk.ComboBoxEntry()
        table.attach(self.StationCountry, 1, 2, 5, 6)
        table.attach(gtk.Label(_("Utopia")), 2, 3, 5, 6)

        table.attach(gtk.Label(_("Language")), 0, 1, 6, 7)
        self.StationLanguage = gtk.ComboBoxEntry()
        table.attach(self.StationLanguage, 1, 2, 6, 7)
        table.attach(gtk.Label(_("Esperanto")), 2, 3, 6, 7)

        table.attach(gtk.Label(_("Tags")), 0, 1, 7, 8)
        self.StationTags = gtk.Entry()
        table.attach(self.StationTags, 1, 2, 7, 8)
        table.attach(gtk.Label(_("Classical Jazz Talk")), 2, 3, 7, 8)

        self.get_content_area().pack_start(table, False)

        self.set_title(_("Post new station"))
        self.set_resizable(False)
        self.set_position(gtk.WIN_POS_CENTER)
        self.show_all()
Пример #5
0
    def __init__(self, names_type):
        # Create a set of combos, using names_type = [(name, direction) ...]
        # where direction is either 'i' or 'o'
        self.set_combos = {}
        self.set_combos_preference = {}
        self.read_combos = {}
        self.read_combos_preference = {}
        # Create a table for all the boxes
        self.table = gtk.Table(len(names_type), 2)

        # Create all combo boxes
        for i in range(len(names_type)):
            # Create a label
            name, type = names_type[i] 
            self.table.attach(gtk.Label(name), 0, 1, i, i+1, gtk.EXPAND|gtk.FILL, 0)
            # Create a liststore to store all the options
	    liststore = gtk.ListStore(gobject.TYPE_STRING)
            # Create a combobox
            combo = gtk.ComboBoxEntry(liststore, 0)
            # Stick it in the table
            self.table.attach(combo, 1, 2, i, i+1, gtk.EXPAND|gtk.FILL, 0)
            # Save it in read_combos, or save_combos 
            if (type == 'i'):
                self.read_combos[name] = combo
                self.read_combos_preference[name] = "<empty>"
            elif (type == 'o'):
                self.set_combos[name] = combo
                self.set_combos_preference[name] = "<empty>"
Пример #6
0
    def register(self):
        self.active_script = None
        self.script_args = None
        self.topvbox = gtk.VBox(False, 0)
        scripts = os.listdir(SCRIPT_DIR)
        # Create a liststore to store all the options
        liststore = gtk.ListStore(gobject.TYPE_STRING)

        self.tree = helpers.typical_ncol_tree([
            (gobject.TYPE_STRING, 'setting', 0),
            (gobject.TYPE_DOUBLE, 'value', 1)
        ])

        iter = None
        for name in scripts:
            if (not name.endswith(".py")): continue
            name = name[:-3]
            if not iter: iter = liststore.append([name])
            else: liststore.append([name])

        # Create a combobox
        combo = gtk.ComboBoxEntry(liststore, 0)
        combo.connect("changed", self.combo_changed, None)
        combo.set_active_iter(iter)

        self.topvbox.pack_start(combo, False, False, 0)
        self.topvbox.pack_start(self.tree.treeview, True, True, 0)

        self.ui_target.add(self.topvbox)
        self.ui_target.show_all()
        return
Пример #7
0
    def __init__(self, field_name, model_name, attrs=None):
        super(Char, self).__init__(field_name, model_name, attrs=attrs)

        self.widget = gtk.HBox()
        self.autocomplete = bool(attrs.get('autocomplete'))
        if self.autocomplete:
            self.entry = gtk.ComboBoxEntry()
            self.entry_store = gtk.ListStore(gobject.TYPE_STRING)
            self.entry.set_model(self.entry_store)
            self.entry.set_text_column(0)
            completion = gtk.EntryCompletion()
            completion.set_model(self.entry_store)
            completion.set_text_column(0)
            self.entry.get_child().set_completion(completion)
            focus_entry = self.entry.get_child()
        else:
            self.entry = gtk.Entry()
            focus_entry = self.entry

        focus_entry.set_property('activates_default', True)
        focus_entry.connect('activate', self.sig_activate)
        focus_entry.connect('focus-out-event', lambda x, y: self._focus_out())
        focus_entry.connect('key-press-event', self.send_modified)
        expand, fill = True, True
        if attrs.get('size'):
            expand, fill = False, False
        self.widget.pack_start(self.entry, expand=expand, fill=fill)

        self.button = None
        if attrs.get('translate'):
            self.button = self.translate_button()
            self.widget.pack_start(self.button, False, False)
Пример #8
0
    def __init__(self,
                 default_path,
                 label,
                 browse_prompt,
                 volume_monitor=None,
                 directory=True):
        gtk.VBox.__init__(self)
        self.browse_prompt = browse_prompt
        self.directory = directory
        self.model = gtk.ListStore(str, gtk.gdk.Pixbuf, str)
        self.vm = volume_monitor
        volume_monitor.connect_after("mount-added", self.set_mounts)
        volume_monitor.connect_after("mount-removed", self.set_mounts)
        self.combo_entry = gtk.ComboBoxEntry(self.model, 0)
        cpb = gtk.CellRendererPixbuf()
        self.combo_entry.pack_start(cpb, False)
        self.combo_entry.reorder(cpb, 0)
        self.combo_entry.add_attribute(cpb, 'pixbuf', 1)

        box, self.path_entry, self.browse_dir_button = box_add(
            self,
            [(self.combo_entry, True, None),
             (gtk.Button('...'), False, "clicked", self.browse_path)
             ],  #stock=gtk.STOCK_OPEN
            label)
        self.set_mounts()
Пример #9
0
    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_name = widgets.BasicEntry()
        self.filter_id = widgets.BasicEntry()
        self.filter_birth = widgets.DateEntry(uistate, [])
        self.filter_death = widgets.DateEntry(uistate, [])
        self.filter_event = gen.lib.Event()
        self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
        self.etype = gtk.ComboBoxEntry()
        self.event_menu = widgets.MonitoredDataType(self.etype,
                                                    self.filter_event.set_type,
                                                    self.filter_event.get_type)

        self.filter_note = widgets.BasicEntry()
        self.filter_gender = gtk.combo_box_new_text()
        map(self.filter_gender.append_text,
            [_('any'), _('male'),
             _('female'), _('unknown')])
        self.filter_gender.set_active(0)

        self.filter_regex = gtk.CheckButton(_('Use regular expressions'))

        self.tag = gtk.ComboBox()
        self.generic = gtk.ComboBox()

        SidebarFilter.__init__(self, dbstate, uistate, "Person")
Пример #10
0
    def __init__(self, text, name, entries):
        Option.__init__(self, text, name)

        self.combo = CustomComboBoxEntry(gtk.ComboBoxEntry())
        self.combo.set_entries(entries)

        self.pack_start(self.combo.combo_box, False)
Пример #11
0
    def create_widget(self):
        widget = gtk.ComboBoxEntry()

        # customizing entry
        widget.child.props.activates_default = True
        widget.child.connect('changed', self.parent_widget.send_modified)
        widget.child.connect('focus-out-event',
                             lambda w, e: self.parent_widget._focus_out())
        widget.child.connect('activate',
                             lambda w: self.parent_widget._focus_out())
        widget.connect('notify::active',
                       lambda w, e: self.parent_widget._focus_out())
        selection_shortcuts(widget)

        # setting completion and selection
        model = gtk.ListStore(gobject.TYPE_STRING)
        model.append(('', ))
        self._selection = {'': None}
        width = 10
        for value, name in sorted(self.definition['selection'],
                                  key=operator.itemgetter(1)):
            name = str(name)
            self._selection[name] = value
            model.append((name, ))
            width = max(width, len(name))
        widget.set_model(model)
        widget.set_text_column(0)
        widget.child.set_width_chars(width)
        completion = gtk.EntryCompletion()
        if hasattr(completion, 'set_inline_selection'):
            completion.set_inline_selection(True)
        completion.set_model(model)
        widget.child.set_completion(completion)
        completion.set_text_column(0)
        return widget
Пример #12
0
 def test_combobox_entry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     # might cause a Pango warning, do not break on this
     old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_CRITICAL
                                          | GLib.LogLevelFlags.LEVEL_ERROR)
     try:
         combo = gtk.ComboBoxEntry(model=liststore)
     finally:
         GLib.log_set_always_fatal(old_mask)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
Пример #13
0
    def __on_add_bl_button_cb(self, widget):
        dialog = gtk.MessageDialog(
            None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK, None)

        def responseToDialog(entry, dialog, response):
            dialog.response(response)

        dialog.set_markup(_('Introduce the nannycentral repository url'))
        options = gtk.ListStore(str)
        options.append(['URL_DE_LA_LISTA'])
        entry = gtk.ComboBoxEntry(options, column=0)
        entry.child.connect("activate", responseToDialog, dialog,
                            gtk.RESPONSE_OK)
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label("Url:"), False, 5, 5)
        hbox.pack_end(entry)
        dialog.format_secondary_markup(
            _("It's something like http://www.nannycentral.info/blacklist/blacklist.json ..."
              ))
        dialog.vbox.pack_end(hbox, True, True, 0)
        dialog.show_all()
        dialog.run()
        text = entry.child.get_text()
        dialog.destroy()

        if not text.startswith("http:/"):
            text = "http://" + text

        result = self.dbus_client.add_pkg_filter(text)
Пример #14
0
    def __init__(self, view, attrs):
        super(Char, self).__init__(view, attrs)

        self.widget = gtk.HBox()
        self.autocomplete = bool(attrs.get('autocomplete'))
        if self.autocomplete:
            self.entry = gtk.ComboBoxEntry()
            selection_shortcuts(self.entry)
            focus_entry = self.entry.get_child()
            self.set_popdown([], self.entry)
            self.entry.connect('changed', self.changed)
        else:
            self.entry = gtk.Entry()
            focus_entry = self.entry
        self.mnemonic_widget = focus_entry

        focus_entry.set_property('activates_default', True)
        focus_entry.connect('activate', self.sig_activate)
        focus_entry.connect('focus-out-event', lambda x, y: self._focus_out())
        focus_entry.connect('key-press-event', self.send_modified)
        expand, fill = True, True
        if attrs.get('size'):
            expand, fill = False, False
        self.widget.pack_start(self.entry, expand=expand, fill=fill)

        if attrs.get('translate'):
            self.entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY,
                                           'tryton-locale')
            self.entry.connect('icon-press', self.translate)
Пример #15
0
    def __init__(self, window, parent, model, attrs=None):
        if attrs is None:
            attrs = {}
        interface.widget_interface.__init__(self, window, parent, model, attrs)

        self.widget = gtk.HBox(spacing=3)

        self.widget_combo = gtk.ComboBoxEntry()
        self.widget_combo.child.set_editable(False)
        self.widget_combo.child.connect('changed', self.sig_changed_combo)
        self.widget_combo.child.connect('key_press_event',
                                        self.sig_key_pressed)
        self.widget_combo.set_size_request(int(attrs.get('size', -1)), -1)
        self.widget.pack_start(self.widget_combo, expand=False, fill=True)

        self.widget.pack_start(gtk.Label('-'), expand=False, fill=False)

        self.wid_text = gtk.Entry()
        self.wid_text.set_property('width-chars', 13)
        self.wid_text.connect('key_press_event', self.sig_key_press)
        self.wid_text.connect('button_press_event', self._menu_open)
        self.wid_text.connect_after('changed', self.sig_changed)
        self.wid_text.connect_after('activate', self.sig_activate)
        self.wid_text_focus_out_id = self.wid_text.connect_after(
            'focus-out-event', self.sig_activate, True)
        self.widget.pack_start(self.wid_text, expand=True, fill=True)

        self.but_new = gtk.Button()
        img_new = gtk.Image()
        img_new.set_from_stock('gtk-new', gtk.ICON_SIZE_BUTTON)
        self.but_new.set_image(img_new)
        self.but_new.set_relief(gtk.RELIEF_NONE)
        self.but_new.connect('clicked', self.sig_new)
        self.but_new.set_alignment(0.5, 0.5)
        self.but_new.set_property('can-focus', False)
        self.but_new.set_tooltip_text(_('Create a new resource'))
        self.widget.pack_start(self.but_new, expand=False, fill=False)

        self.but_open = gtk.Button()
        img_find = gtk.Image()
        img_find.set_from_stock('gtk-find', gtk.ICON_SIZE_BUTTON)
        img_open = gtk.Image()
        img_open.set_from_stock('gtk-open', gtk.ICON_SIZE_BUTTON)
        self.but_open.set_image(img_find)
        self.but_open.set_relief(gtk.RELIEF_NONE)
        self.but_open.connect('clicked', self.sig_edit)
        self.but_open.set_alignment(0.5, 0.5)
        self.but_open.set_property('can-focus', False)
        self.but_open.set_tooltip_text(_('Search / Open a resource'))
        self.widget.pack_start(self.but_open,
                               padding=2,
                               expand=False,
                               fill=False)

        self.ok = True
        self._readonly = False
        self.set_popdown(attrs.get('selection', []))

        self.last_key = (None, 0)
        self.key_catalog = {}
Пример #16
0
    def initialize_window(self):
        """Show the intro page"""
        self.html = HtmlTextView()
        self.html.connect("url-clicked", self.link_clicked)
        self.html.display_html(
            '<div><span style="color: red; text-decoration:underline">Welcome to</span><br/>\n'
            '  <img src="http://comptune.com/images/penguin5.gif" alt="penguin" height="48" width="48" /><br/>\n'
            '  <span style="font-size: 500%; font-family: serif">crowbar</span>\n'
            '</div>\n')
        self.sw1.add(self.html)
        #~ add a search comboboxentry1 and 3 buttons
        self.liststore1 = gtk.ListStore(str)
        self.comboboxentry1 = gtk.ComboBoxEntry(self.liststore1, 0)
        popular = ['#teamfollowback', '#tfb', '#f4f']
        trending = api.GetTrendsCurrent()
        trends = [x.name for x in trending]
        for row in popular:
            self.liststore1.append([row])
        for row in trends:
            self.liststore1.append([row])

        # insert a horizontal box with combo and buttons
        self.hbox2 = gtk.HBox(homogeneous=False)
        self.hbox2.pack_start(self.comboboxentry1)
        button = gtk.Button()
        button.set_label('search')
        button.set_property('width-request', 55)
        button.connect('clicked', self.search_clicked,
                       self.comboboxentry1.child.get_text)
        self.hbox2.pack_start(button, expand=False, fill=True)
        button = gtk.Button()
        button.set_label('friends')
        button.set_property('width-request', 55)
        button.connect('clicked', self.timeline_clicked,
                       self.comboboxentry1.child.get_text)
        self.hbox2.pack_start(button, expand=False, fill=True)
        button = gtk.Button()
        button.set_label('user')
        button.set_property('width-request', 40)
        button.connect('clicked', self.user_timeline_clicked,
                       self.comboboxentry1.child.get_text)
        self.hbox2.pack_start(button, expand=False, fill=True)
        button = gtk.Button()
        button.set_label('dm')
        button.set_property('width-request', 35)
        button.connect('clicked', self.dm_clicked,
                       self.comboboxentry1.child.get_text)
        self.hbox2.pack_start(button, expand=False, fill=True)
        button = gtk.Button()
        button.set_label('mention')
        button.set_property('width-request', 70)
        button.connect('clicked', self.mentions_clicked,
                       self.comboboxentry1.child.get_text)
        self.hbox2.pack_start(button, expand=False, fill=True)

        #~ testify.test(self)
        self.vbox1.pack_start(self.hbox2, expand=False)
        self.html.show_all()
        self.hbox2.show_all()
Пример #17
0
 def __init__(self, revisions, revision=None, format_='%x %H:%M:%S.%f'):
     self.parent = get_toplevel_window()
     self.win = gtk.Dialog(
         _('Revision'), self.parent,
         gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
     Main().add_window(self.win)
     cancel_button = self.win.add_button(set_underline(_("Cancel")),
                                         gtk.RESPONSE_CANCEL)
     cancel_button.set_image(
         IconFactory.get_image('tryton-cancel', gtk.ICON_SIZE_BUTTON))
     cancel_button.set_always_show_image(True)
     ok_button = self.win.add_button(set_underline(_("OK")),
                                     gtk.RESPONSE_OK)
     ok_button.set_image(
         IconFactory.get_image('tryton-ok', gtk.ICON_SIZE_BUTTON))
     ok_button.set_always_show_image(True)
     self.win.set_default_response(gtk.RESPONSE_OK)
     self.win.set_icon(TRYTON_ICON)
     self.win.vbox.set_spacing(3)
     self.win.vbox.pack_start(gtk.Label(_('Select a revision')),
                              expand=False,
                              fill=True)
     self.win.vbox.pack_start(gtk.HSeparator())
     hbox = gtk.HBox(spacing=3)
     label = gtk.Label(_('Revision:'))
     hbox.pack_start(label, expand=True, fill=True)
     list_store = gtk.ListStore(str, str)
     # Set model on instantiation to get the default cellrenderer as text
     combobox = gtk.ComboBoxEntry(model=list_store)
     # JCA : Force set text colmn for gtk2
     combobox.set_text_column(0)
     self.entry = combobox.get_child()
     self.entry.connect('focus-out-event', self.focus_out)
     self.entry.connect('activate', self.activate)
     label.set_mnemonic_widget(self.entry)
     combobox.connect('changed', self.changed)
     self.entry.set_property('activates_default', True)
     self._format = format_
     if revision:
         self.entry.set_text(datetime_strftime(revision, self._format))
         self._value = revision
         active = -1
     else:
         self._value = None
         active = 0
     list_store.append(('', ''))
     for i, (rev, id_, name) in enumerate(revisions, 1):
         list_store.append((datetime_strftime(rev, self._format), name))
         if rev == revision:
             active = i
     combobox.set_active(active)
     cell = gtk.CellRendererText()
     combobox.pack_start(cell, True)
     combobox.add_attribute(cell, 'text', 1)
     hbox.pack_start(combobox, expand=True, fill=True)
     combobox.set_entry_text_column(0)
     self.win.vbox.pack_start(hbox, expand=True, fill=True)
     self.win.show_all()
Пример #18
0
    def __init__(self,
                 mapping,
                 cbe=None,
                 custom_key=None,
                 active_key=None,
                 additional=None,
                 menu=None):
        """
        Constructor for the StandardCustomSelector class.

        :param cbe: Existing ComboBoxEntry widget to use.
        :type cbe: gtk.ComboBoxEntry
        :param mapping: The mapping between integer and string constants.
        :type mapping:  dict
        :param custom_key: The key corresponding to the custom string entry
        :type custom_key:  int
        :param active_key: The key for the entry to make active upon creation
        :type active_key:  int
        """

        # set variables
        self.mapping = mapping
        self.custom_key = custom_key
        self.active_key = active_key
        self.active_index = 0
        self.additional = additional
        self.menu = menu

        # create combo box entry
        if cbe:
            self.selector = cbe
        else:
            self.selector = gtk.ComboBoxEntry()

        # create models
        if menu:
            self.store = self.create_menu()
            completion_store = self.create_list()
        else:
            self.store = self.create_list()
            completion_store = self.store

        self.selector.set_model(self.store)
        self.selector.set_text_column(1)

        if menu:
            for cell in self.selector.get_cells():
                self.selector.add_attribute(cell, 'sensitive', 2)

        #if self.active_key is not None:
        #self.selector.set_active(self.active_index)

        # make autocompletion work
        completion = gtk.EntryCompletion()
        completion.set_model(completion_store)
        completion.set_minimum_key_length(1)
        completion.set_text_column(1)
        self.selector.child.set_completion(completion)
Пример #19
0
    def add_transaction(self):
        dialog = gtk.Dialog('Add Transaction', None, gtk.DIALOG_MODAL,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_ADD, gtk.RESPONSE_ACCEPT))
        dialog.set_position(gtk.WIN_POS_CENTER)
        table = gtk.Table(6, 2)

        name_label = gtk.Label('Name')
        name_label.set_alignment(0.90, 0.5)
        code_label = gtk.Label('Stock code')
        code_label.set_alignment(0.90, 0.5)
        action_label = gtk.Label('Action')
        action_label.set_alignment(0.90, 0.5)
        date_label = gtk.Label('Date')
        date_label.set_alignment(0.90, 0.5)
        quantity_label = gtk.Label('Quantity')
        quantity_label.set_alignment(0.90, 0.5)
        price_label = gtk.Label('Price')
        price_label.set_alignment(0.90, 0.5)

        table.attach(name_label, 0, 1, 0, 1)
        table.attach(code_label, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL, gtk.SHRINK)
        table.attach(action_label, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)
        table.attach(date_label, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL, gtk.SHRINK)
        table.attach(quantity_label, 0, 1, 4, 5, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)
        table.attach(price_label, 0, 1, 5, 6, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)

        name_entry = gtk.Entry()
        code_entry = gtk.Entry()
        date_selector = guiutils.DateEntry()
        quantity_entry = gtk.Entry()
        price_entry = gtk.Entry()

        combolist = gtk.ListStore(gobject.TYPE_STRING)
        for item in ['Buy', 'Sell']:
            combolist.append([item])
        action_combobox = gtk.ComboBoxEntry(combolist)

        table.attach(name_entry, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.SHRINK)
        table.attach(code_entry, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.SHRINK)
        table.attach(action_combobox, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)
        table.attach(date_selector, 1, 2, 3, 4, gtk.SHRINK)
        table.attach(quantity_entry, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)
        table.attach(price_entry, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL,
                     gtk.SHRINK)

        dialog.vbox.pack_start(table)
        dialog.show_all()
        resp = dialog.run()

        if resp == gtk.RESPONSE_CANCEL:
            dialog.destroy()
Пример #20
0
 def _create_widgets(self):
     self.lbl_scan = HIGSectionLabel(self.title)
     self.hbox = HIGHBox()
     self.table = HIGTable()
     self.list_scan = gtk.ListStore(str)
     self.combo_scan = gtk.ComboBoxEntry(self.list_scan, 0)
     self.btn_open_scan = gtk.Button(stock=gtk.STOCK_OPEN)
     self.exp_scan = gtk.Expander(_("Scan Output"))
     self.scrolled = gtk.ScrolledWindow()
     self.txt_scan_result = gtk.TextView()
     self.txg_tag = gtk.TextTag("scan_style")
Пример #21
0
 def setup_edit_widget (self):
     '''Return an edit widget to let users edit your data.
     '''
     self.cb = cb = gtk.ComboBoxEntry()
     cb.set_model(self.shopcat_model)
     cb.set_text_column(0)
     entry = cb.child
     completion = gtk.EntryCompletion()
     completion.set_model(self.shopcat_model)
     completion.set_text_column(0)
     entry.set_completion(completion)
     return cb
Пример #22
0
 def _get_add_widget(self):
     add_hbox = gtk.HBox()
     add_entry = gtk.ComboBoxEntry()
     add_entry.connect("changed", self._handle_combo_choice)
     add_entry.child.connect(
         "key-press-event",
         lambda w, e: self._handle_text_choice(add_entry, e))
     add_entry.set_tooltip_text(rose.config_editor.CHOICE_TIP_ENTER_CUSTOM)
     add_entry.show()
     self._set_available_hints(add_entry)
     add_hbox.pack_end(add_entry, expand=True, fill=True)
     add_hbox.show()
     return add_hbox
    def _create_widgets(self):
        self.vbox = HIGVBox()
        self.button_box = gtk.HButtonBox()
        
        self.submitted_label = HIGHintSectionLabel(_("Submitted by (optional)"),
                                                   _("Enter your name and \
e-mail address if we can contact you with any questions. (kept private, \
used for nothing else)"))
        self.submitted_entry = gtk.Entry()

        self.target_device_label = HIGHintSectionLabel(_("Target OS/device info"),
                                                       _("<b>The more details \
the better!</b> For UNIX machines, '<i>uname -a</i>' often gives the proper \
version number. On Linux, please also specify the distribution version (such as\
Redhat 9.0) if you are using a vendor-provided kernel. For Windows, the \
'<i>winver</i>' command (if available) should show you any service pack \
information. If a Windows target has no service packs installed, \
please say so explicitly. For appliances/embedded devices, please mention \
the model number and what it is (printer, webcam, DSL router, VOIP phone, \
etc). Try to provide the architecture (X86, SPARC, etc.) where appropriate."))
        self.target_device_entry = gtk.Entry()

        self.classification_label = HIGHintSectionLabel(_("Classification"),
                                                        _("Please select \
the Device/OS info from this alphabetized choosebox"))
        self.classification_list = gtk.ListStore(str, str)
        self.classification_combo = gtk.ComboBoxEntry(self.classification_list,
                                                      0)

        self.notes_label = HIGHintSectionLabel(_("Notes"),
                                               _("Fill with further info on \
the device, any special network conditions, etc."))
        self.notes_scrolled = gtk.ScrolledWindow()
        self.notes_text = gtk.TextView()

        self.fingerprint_icon = gtk.Image()
        self.fingerprint_text = gtk.Label(_("This form allows you to \
contribute new operating system fingerprints to the Nmap database. Thanks for \
helping! <b>Please do not fill this out unless you are sure that you know \
what application is running on the machine you are submitting</b>. Incorrect \
entries can pollute the database. By submitting fingerprints you are \
transfering any copyright interest in the data to Fyodor so that he \
can modify it, relicense it, incorporate it into programs such as Nmap, etc."))

        self.btn_ok = gtk.Button(stock=gtk.STOCK_OK)
        self.btn_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)

        self.hbox = HIGHBox()
        self.table = HIGTable()
Пример #24
0
    def __init__(self, field_name, model_name, attrs=None):
        super(Reference, self).__init__(field_name, model_name, attrs=attrs)

        self.widget_combo = gtk.ComboBoxEntry()
        child = self.widget_combo.get_child()
        child.set_editable(False)
        child.connect('changed', self.sig_changed_combo)
        self.widget.pack_start(self.widget_combo, expand=False, fill=True)

        self.widget.pack_start(gtk.Label('-'), expand=False, fill=False)

        self.init_selection()
        self.set_popdown(self.selection, self.widget_combo)

        self.widget.set_focus_chain([self.widget_combo, self.wid_text])
Пример #25
0
    def __init__(self, parent):
        self.parent = parent

        self.builder = gtk.Builder()
        """
        try:
            self.builder.add_from_file(os.path.join(path,'measureupload.glade'))
        except:
            path = os.path.dirname( os.path.realpath( __file__ ) )
            self.builder.add_from_file(os.path.join(path, 'measureupload.glade'))
        """
        self.builder.add_from_string(
            resource_string(__name__, 'measureupload.glade'))
        self.builder.connect_signals(self)

        self.servers = self.getServers()

        servListstore = gtk.ListStore(str)

        for s in self.servers.keys():
            servListstore.append([s])

        self.ipCombo = gtk.ComboBoxEntry(servListstore, 0)

        self.ipCombo.set_property('width-request', 150)
        ipBox = self.builder.get_object("ipBox")
        ipBox.pack_start(self.ipCombo, True, True, 0)
        self.ipCombo.show()

        dip = self.parent.preferences.getDefaultServer()
        i = 0
        found = 0
        for k, v in self.servers.items():
            if dip == k:
                found = i
            i += 1

        if self.servers:
            self.ipCombo.set_active(found)

        self.tview = self.builder.get_object('textview')
        self.tbuffer = gtk.TextBuffer()
        self.tview.set_buffer(self.tbuffer)

        self.addText('Choose server and press Start')

        self.ui = self.builder.get_object('ui')
        self.ui.show()
Пример #26
0
    def __init__(self):
        HIGHBox.__init__(self)
        self.entry = gtk.SpinButton(gtk.Adjustment(value=30,
                                                   lower=0,
                                                   upper=9999,
                                                   step_incr=1), 1)
        self.time_list = gtk.ListStore(str)
        self.time_combo = gtk.ComboBoxEntry(self.time_list, 0)

        self.entry.set_width_chars(4)

        for i in SearchConfig().time_list:
            self.time_list.append([i])

        self._pack_noexpand_nofill(self.entry)
        self._pack_expand_fill(self.time_combo)
Пример #27
0
    def add_item(self, widget, string):
        self.addWindow = gtk.Window()
        self.addWindow.set_border_width(1)
        self.addWindow.set_default_size(300, 390)
        self.addWindow.set_title("Add Receipt")
        self.addWindow.set_position(gtk.WIN_POS_CENTER)
        addFixed = gtk.Fixed()
        self.addWindow.add(addFixed)

        priceLabel = gtk.Label("Price:")
        descriptionLabel = gtk.Label("Description:")
        categoryLabel = gtk.Label("Category:")

        self.priceEntry = gtk.Entry(max=20)
        self.descriptionEntry = gtk.Entry(max=100)

        categories = self.profile.getCategories()
        categoriesList = gtk.ListStore(gobject.TYPE_STRING)
        for category in categories:
            categoriesList.append([category])
        self.categoryEntry = gtk.ComboBoxEntry(categoriesList)
        self.categoryEntry.set_size_request(160, 25)
        self.categoryEntry.set_active(0)
        self.calendarEntry = gtk.Calendar()

        self.priceEntry.connect("activate", self.confirm_add_item)
        self.descriptionEntry.connect("activate", self.confirm_add_item)

        self.errorLabel = gtk.Label()

        addFixed.put(priceLabel, 15, 40)
        addFixed.put(self.priceEntry, 100, 35)
        addFixed.put(descriptionLabel, 15, 75)
        addFixed.put(self.descriptionEntry, 100, 70)
        addFixed.put(categoryLabel, 15, 110)
        addFixed.put(self.categoryEntry, 100, 105)
        addFixed.put(self.calendarEntry, 35, 155)
        addFixed.put(self.errorLabel, 105, 10)

        confirmButton = gtk.Button("Confirm")
        cancelButton = gtk.Button("Cancel")
        confirmButton.connect("clicked", self.confirm_add_item)
        cancelButton.connect("clicked", self.cancel_add_item)
        addFixed.put(confirmButton, 80, 340)
        addFixed.put(cancelButton, 170, 340)

        self.addWindow.show_all()
Пример #28
0
 def __init__(self, revisions, revision=None, format_='%x %X.%f'):
     self.parent = get_toplevel_window()
     self.win = gtk.Dialog(
         _('Revision'), self.parent,
         gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
         (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK,
          gtk.RESPONSE_OK))
     self.win.set_default_response(gtk.RESPONSE_OK)
     self.win.set_icon(TRYTON_ICON)
     self.win.set_has_separator(True)
     self.win.vbox.set_spacing(3)
     self.win.vbox.pack_start(gtk.Label(_('Select a revision')),
                              expand=False,
                              fill=True)
     self.win.vbox.pack_start(gtk.HSeparator())
     hbox = gtk.HBox(spacing=3)
     label = gtk.Label(_('Revision:'))
     hbox.pack_start(label, expand=True, fill=True)
     list_store = gtk.ListStore(str, str)
     combobox = gtk.ComboBoxEntry(list_store)
     self.entry = combobox.child
     self.entry.connect('focus-out-event', self.focus_out)
     self.entry.connect('activate', self.activate)
     label.set_mnemonic_widget(self.entry)
     combobox.connect('changed', self.changed)
     self.entry.set_property('activates_default', True)
     self._format = format_
     if revision:
         self.entry.set_text(datetime_strftime(revision, self._format))
         self._value = revision
         active = -1
     else:
         self._value = None
         active = 0
     list_store.append(('', ''))
     for i, (rev, id_, name) in enumerate(revisions, 1):
         list_store.append((datetime_strftime(rev, self._format), name))
         if rev == revision:
             active = i
     combobox.set_active(active)
     cell = gtk.CellRendererText()
     combobox.pack_start(cell, True)
     combobox.add_attribute(cell, 'text', 1)
     hbox.pack_start(combobox, expand=True, fill=True)
     combobox.set_entry_text_column(0)
     self.win.vbox.pack_start(hbox, expand=True, fill=True)
     self.win.show_all()
Пример #29
0
 def __init__(self, namelist, callback=None, name=None):
     # If a callback is provided, it's called a *lot* of times.
     # It's called for every keystroke in the entry part of the
     # widget and every time a selection is made in the list part
     # of the widget.
     debug.mainthreadTest()
     liststore = gtk.ListStore(gobject.TYPE_STRING)
     self.combobox = gtk.ComboBoxEntry(liststore, 0)
     if name:
         gtklogger.setWidgetName(self.combobox, name)
     self.gtk = self.combobox
     self.namelist = []
     self.current_string = None
     self.update(namelist)
     self.signal = gtklogger.connect(self.combobox, 'changed',
                                     self.changedCB)
     self.callback = callback
Пример #30
0
 def __init__(self):
     window = gtk.Window()
     window.connect('destroy', lambda w: gtk.main_quit())
     comboboxentry = gtk.ComboBoxEntry()
     window.add(comboboxentry)
     liststore = gtk.ListStore(str)
     comboboxentry.set_model(liststore)
     liststore.append(['Apple'])
     liststore.append(['Cherry'])
     liststore.append(['Blueberry'])
     liststore.append(['Grape'])
     liststore.append(['Peach'])
     liststore.append(['Raisin'])
     comboboxentry.set_text_column(0)
     comboboxentry.child.connect('changed', self.changed_cb)
     comboboxentry.set_active(0)
     window.show_all()
     return