예제 #1
0
 def setup_constraints_tree(self):
     tree = self.w("treeview_task_constraints")
     self.constraints_model = gtk.ListStore(gobject.TYPE_STRING, # type
                                            gobject.TYPE_STRING, # task_id
                                            gobject.TYPE_STRING, # task title
                                            gobject.TYPE_STRING, # color (inherited or not)
                                            gobject.TYPE_BOOLEAN, # editable
                                            gobject.TYPE_INT, # Priority
                                            )
     rend = gtk.CellRendererCombo()
     rend.set_property('model', self.constraints_type_model )
     rend.set_property('has-entry', False)
     rend.set_property('text-column', 0)
     rend.connect('edited', self.on_constraint_type_edited )
     col = gtk.TreeViewColumn( u"Type", rend, text=0, foreground=3, editable=4 )
     tree.append_column( col )
     rend = gtk.CellRendererCombo()
     rend.set_property('model', self.task_model)
     rend.set_property('text-column', 1)
     rend.connect('edited', self.on_constraint_arg_edited )
     col = gtk.TreeViewColumn( u"Task ID", rend, text=1, foreground=3, editable=4 )
     tree.append_column( col )
     p_rend = gtk.CellRendererText() # TODO : make it editable
     #p_rend.connect('edited', self.on_constraint_priority_edited )
     col = gtk.TreeViewColumn( u"Priority", p_rend, text=5,
                               foreground=3, editable=False )
     tree.append_column( col )
     col = gtk.TreeViewColumn( u"Task Title", gtk.CellRendererText(), text=2,
                              foreground=3, editable=False )
     tree.append_column( col )
     tree.set_model( self.constraints_model )
     tree.enable_model_drag_dest( [ ("task", gtk.TARGET_SAME_APP, 0) ],
                                  gtk.gdk.ACTION_COPY )
예제 #2
0
    def _build_view_rules(self):
        self.lstore_rules = gtk.ListStore(str, str, str, str, float)
        view = gtk.TreeView(model=self.lstore_rules)

        # Create field to set the type of rule tracker/label
        liststore_field_type = gtk.ListStore(str)
        for item in ["Tracker", "Label"]:
            liststore_field_type.append([item])
        crc = gtk.CellRendererCombo()
        crc.set_property("editable", True)
        crc.set_property("model", liststore_field_type)
        crc.set_property("text-column", 0)
        crc.set_property("has-entry", False)
        crc.connect("edited", self._on_combo_type_changed)
        # crc.set_active(0)
        colc = gtk.TreeViewColumn(_("Type"), crc, text=0)
        view.append_column(colc)

        # Create text field for label or tracker names
        crt = gtk.CellRendererText()
        crt.set_property("editable", True)
        crt.connect("edited", self._on_name_changed)
        colt = gtk.TreeViewColumn(_("Name"), crt, text=1)
        view.append_column(colt)

        # Create field to set the type of selection and/or
        liststore_field_logic = self.sel_func_store
        crl = gtk.CellRendererCombo()
        crl.set_property("editable", True)
        crl.set_property("model", liststore_field_logic)
        crl.set_property("text-column", 0)
        crl.set_property("has-entry", False)
        crl.connect("edited", self._on_combo_logic_changed)
        #crl.set_active(0) #TODO
        coll = gtk.TreeViewColumn(_("Operator"), crl, text=2)
        view.append_column(coll)

        # Create field for remove rule selection
        liststore_field_rules = self.rules
        crrr = gtk.CellRendererCombo()
        crrr.set_property("editable", True)
        crrr.set_property("model", liststore_field_rules)
        crrr.set_property("text-column", 1)
        crrr.set_property("has-entry", False)
        crrr.connect("edited", self._on_combo_rules_changed)
        colrr = gtk.TreeViewColumn(_("Remove Rule"), crrr, text=3)
        view.append_column(colrr)

        # Spin button for minimum value
        crm = gtk.CellRendererSpin()
        crm.set_property("editable", True)
        crm.set_property("digits", 3)
        crm.set_property("adjustment", gtk.Adjustment(0, 0, 10000.0, 0.5, 10,
                                                      0))
        crm.connect("edited", self._on_spin_min_changed)
        colm = gtk.TreeViewColumn(_("Minimum"), crm, text=4)
        view.append_column(colm)

        return view
예제 #3
0
    def __init__(self, config_path):
        gtk.TreeView.__init__(self)

        self.config = ConfigParser()
        self.config_path = config_path

        self.model_from_lang = gtk.ListStore(str, str)
        self.model_to_lang = gtk.ListStore(str, str)

        # Sort the LANGUAGUES by the value
        languages = sorted(LANGUAGES.items(), key=itemgetter(1))

        # The * means that google will try to guess the source language
        self.model_from_lang.append(['*', ''])
        for code, name in languages:
            self.model_from_lang.append([name, code])

        for code, name in languages:
            self.model_to_lang.append([name, code])

        render_from_lang = gtk.CellRendererCombo()
        render_from_lang.set_property("text-column", 0)
        render_from_lang.set_property("editable", True)
        render_from_lang.set_property("has-entry", False)
        render_from_lang.set_property("model", self.model_from_lang)
        render_from_lang.connect("changed", self.set_from_language)

        render_to_lang = gtk.CellRendererCombo()
        render_to_lang.set_property("text-column", 0)
        render_to_lang.set_property("editable", True)
        render_to_lang.set_property("has-entry", False)
        render_to_lang.set_property("model", self.model_to_lang)
        render_to_lang.connect("changed", self.set_to_language)

        column_from_lang = gtk.TreeViewColumn(_("From language"),
                                              render_from_lang,
                                              text=0)
        column_from_lang.set_expand(True)
        column_to_lang = gtk.TreeViewColumn(_("To language"),
                                            render_to_lang,
                                            text=1)
        column_to_lang.set_expand(True)
        self.append_column(column_from_lang)
        self.append_column(column_to_lang)

        self.treeview_model = gtk.ListStore(str, str, str, str)
        self.set_model(self.treeview_model)

        self._load_config()
예제 #4
0
 def setup_resources_list(self):
     tree = self.w("treeview_resources")
     self.resources_model = gtk.ListStore(
         gobject.TYPE_STRING,  # cal_id
         gobject.TYPE_STRING,  # name
         gobject.TYPE_STRING,  # color
         gobject.TYPE_BOOLEAN,  # editable
     )
     rend = gtk.CellRendererCombo()
     rend.set_property('model', self.calendar_ids)
     rend.set_property('has-entry', False)
     rend.set_property('text-column', 0)
     rend.connect('edited', self.on_calendar_type_edited)
     tree.append_column(
         gtk.TreeViewColumn(u"Cal_ID",
                            rend,
                            text=0,
                            foreground=2,
                            editable=3))
     tree.append_column(
         gtk.TreeViewColumn('Name',
                            gtk.CellRendererText(),
                            text=1,
                            foreground=2))
     tree.set_model(self.resources_model)
예제 #5
0
    def columnaCombo(self, vista, modelo, n, offset=False):
        """
        Create a combo column for a treeview

         vista (widget que muestra el treeview)
         modelo (lista) 
         n (columna)

        Return: modeloCombo (lista para los datos del selector)
        """
        modeloCombo = gtk.ListStore(str)
        vista.renderer[n] = gtk.CellRendererCombo()
        vista.renderer[n].set_property('editable', True)
        vista.renderer[n].connect('edited', self.parent_application.col_edited_cb, modelo, (n - 1 if offset else n))
        vista.renderer[n].set_property('model', modeloCombo)
        #vista.renderer[n].set_property('has-entry', False)
        vista.renderer[n].set_property('text-column', 0)
        vista.append_column(vista.columna[n])
        #vista.columna[n].set_sort_column_id(n)
        vista.columna[n].pack_start(vista.renderer[n], True)
        vista.columna[n].set_attributes(vista.renderer[n], text=(n - 1 if offset else n))
        vista.columna[n].set_resizable(True)
        #vista.columna[n].set_min_width(150)

        return modeloCombo
예제 #6
0
 def setup_tree(self):
     item_renderer = gtk.CellRendererText()
     item_renderer.set_property('editable', True)
     item_col = gtk.TreeViewColumn(_('Item'), item_renderer, text=1)
     item_col.set_expand(True)
     key_renderer = gtk.CellRendererCombo()
     key_renderer.set_property('editable', True)
     key_renderer.connect('editing-started', self.start_keyedit_cb)
     key_renderer.connect('edited', self.key_edited_cb)
     key_renderer.set_property('mode', gtk.CELL_RENDERER_MODE_EDITABLE)
     key_renderer.set_property('sensitive', True)
     key_col = gtk.TreeViewColumn(_('Key'), key_renderer, text=2)
     key_col.set_expand(True)
     self.renderers = [key_renderer, item_renderer]
     self.tv.append_column(item_col)
     self.tv.append_column(key_col)
     for r in key_renderer, item_renderer:
         r.set_property('wrap-mode', pango.WRAP_WORD)
         r.set_property('wrap-width', 200)
     self.tv.connect('check-resize', self.resize_event_cb)
     self.tv.connect('size-allocate', self.tv_size_allocate_cb)
     plugin_manager = keyEditorPluggable.get_key_editor_plugin_manager()
     for tvc in plugin_manager.get_treeview_columns(self,
                                                    key_col=2,
                                                    instant_apply=False):
         self.tv.append_column(tvc)
 def garbage(self):
     """Deprecated method"""
     for tab in CommunicationUserInterface().get_tabs():
         liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                   gobject.TYPE_STRING)
         for name, details in tab['parameters'].items():
             if 'options' in details:
                 options = details['options']
             elif 'logic' in details:
                 options = ['Disable', 'Enable']
             liststore.insert(details['position'], [name, 'A', options])
             self.__log.debug('@Debug loop %s %s' %
                              (str(name), str(details['position'])))
         treeview = gtk.TreeView(liststore)
         treeview.append_column(
             gtk.TreeViewColumn(_('Parameter'),
                                gtk.CellRendererText(),
                                text=0))
         value_renderer = gtk.CellRendererCombo()
         value_renderer.text_column = 2
         value_renderer.mode = gtk.CELL_RENDERER_MODE_EDITABLE
         value_renderer.editable = True
         value_renderer.editable_set = True
         treeview.append_column(
             gtk.TreeViewColumn(_('Value'), value_renderer, text=1))
         self.__notebook.append_page(treeview, gtk.Label(tab['name']))
         treeview.show()
예제 #8
0
    def setup_treeview_column (self, ike, key_col, instant_apply=False):
        '''Set up a treeview column to display your data.

        The key_col is the column in the treemodel which will contain
        your data in the model. It\'s your responsibility to get
        whatever other data you need yourself.

        If you make this editable, it\'s up to you to apply the
        changes as well to the database. If instant_apply is True,
        then apply them instantly; if False, apply them when this
        class\'s save method is called.
        '''
        renderer = gtk.CellRendererCombo()
        renderer.connect('editing-started',self.start_edit_cb)
        renderer.connect('edited',self.key_edited_cb,(ike,key_col,instant_apply))
        # Build shopcat model...
        self.rd = get_recipe_manager()
        self.shopcat_model = gtk.ListStore(str)
        for val in self.rd.get_unique_values('shopcategory',table=self.rd.shopcats_table):
            if val: self.shopcat_model.append([val])
        renderer.set_property('model',self.shopcat_model)
        renderer.set_property('text-column',0)        
        renderer.set_property('editable',True)
        renderer.set_property('mode',gtk.CELL_RENDERER_MODE_EDITABLE)
        renderer.set_property('sensitive',True)        
        tvc = gtk.TreeViewColumn(self.title,renderer)
        tvc.set_cell_data_func(renderer,self.cell_data_func,key_col)
        self.tvcs[renderer] = tvc
        return tvc
예제 #9
0
 def init_combo(self, items, active_item=None):
     cb = gtk.CellRendererCombo()
     cb_index = self.set_model_from_list(cb, items)
     if active_item:
         active = cb_index[active_item]
         cb.set_active(active)
     return cb
예제 #10
0
    def _build_view_trackers(self):
        self.lstore = gtk.ListStore(str, str)
        view = gtk.TreeView(model=self.lstore)

        # Create field to set the type of exemption
        liststore_field = gtk.ListStore(str)
        for item in ["Tracker", "Label"]:
            liststore_field.append([item])
        crc = gtk.CellRendererCombo()
        crc.set_property("editable", True)
        crc.set_property("model", liststore_field)
        crc.set_property("text-column", 0)
        crc.set_property("has-entry", False)
        crc.connect("edited", self._on_combo_changed)
        # crc.set_active(0)
        colc = gtk.TreeViewColumn(_("Type"), crc, text=0)
        view.append_column(colc)

        # Create text field for label or tracker names
        crt = gtk.CellRendererText()
        crt.set_property("editable", True)
        crt.connect("edited", self._text_edited)
        colt = gtk.TreeViewColumn(_("Name"), crt, text=1)
        view.append_column(colt)

        return view
예제 #11
0
    def __init__(self):
        super(EngineTreeView, self).__init__()

        self.__engines = set([])
        self.__changed = False

        # self.set_headers_visible(True)
        self.set_reorderable(True)

        self.__model = gtk.ListStore(gobject.TYPE_PYOBJECT,
                                     gobject.TYPE_STRING)
        self.set_model(self.__model)
        self.__model.connect("row-changed", self.__emit_changed_delay_cb,
                             "row-changed")
        self.__model.connect("row-deleted", self.__emit_changed_delay_cb,
                             "row-deleted")
        self.__model.connect("row-inserted", self.__emit_changed_delay_cb,
                             "row-inserted")
        self.__model.connect("rows-reordered", self.__emit_changed_delay_cb,
                             "rows-reordered")

        # create im name & icon column
        column = gtk.TreeViewColumn(_("Input Method"))
        column.set_min_width(220)

        renderer = gtk.CellRendererPixbuf()
        renderer.set_property("xalign", 0)
        column.pack_start(renderer, False)
        column.set_cell_data_func(renderer, self.__icon_cell_data_cb)

        renderer = gtk.CellRendererText()
        renderer.set_property("xalign", 0)
        renderer.set_property("ellipsize", pango.ELLIPSIZE_END)
        column.pack_start(renderer, True)
        column.set_cell_data_func(renderer, self.__name_cell_data_cb)
        self.append_column(column)

        # create im keyboard layout column
        renderer = gtk.CellRendererCombo()
        model = gtk.ListStore(gobject.TYPE_STRING)
        model.append(("us", ))
        model.append(("jp", ))
        model.append(("xkb", ))
        renderer.set_property("xalign", 0)
        renderer.set_property("model", model)
        renderer.set_property("text-column", 0)
        renderer.set_property("has-entry", False)
        renderer.set_property("editable", True)
        renderer.connect("changed", self.__engine_layout_changed_cb)

        column = gtk.TreeViewColumn(_("Kbd"))
        column.set_expand(False)
        column.set_fixed_width(32)
        column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
        column.pack_start(renderer, False)
        column.set_cell_data_func(renderer, self.__layout_cell_data_cb)
        # self.append_column(column)

        self.get_selection().connect(
            "changed", lambda *args: self.notify("active-engine"))
예제 #12
0
    def init(self):
        # based on list build TreeView
        MainProgramsWindow.do_lists(self.s)
        #self.lcd = UI.LCDScreen(self.s)

        self.xml = gtk.glade.XML("menu.glade", "mainmenu")
        self.mainmenu = self.xml.get_widget("mainmenu")
        self.xml.signal_autoconnect(self)

        self.set_size_request(500,500)

        vbox = gtk.VBox(False,0)
        vbox.pack_start(self.mainmenu)
        vbox.set_child_packing(self.mainmenu, False, True, 0, gtk.PACK_START)

        self.hpaned = gtk.HPaned()
        self.hpaned.set_position(250)
        self.scrolledwindow = gtk.ScrolledWindow()
        self.treestore = self.build_model()
        self.treeview = gtk.TreeView(self.treestore)
        self.treeview.connect("button_press_event", self.on_treeview_button_press_event)
        self.treeview.connect("button_release_event", self.on_treeview_button_release_event)
        self.treeview.connect("motion_notify_event", self.on_treeview_motion_notify_event)

        textedit = gtk.CellRendererText()
        textedit.set_property('editable', False)
        textedit.connect('edited', self.on_textedit_changed, (self.treestore, 0))

        sampleedit = gtk.CellRendererCombo()
        sampleedit.set_property('editable', True)
        sampleedit.set_property('model', self.s.samplesmodel)
        sampleedit.set_property('text-column', 1)
        sampleedit.connect('edited', self.on_sampleedit_changed, (self.treestore, 1))
        sampleedit.connect('editing-started', self.on_sampleedit_started)

        leveledit = CellRendererKnob(self.s)
        """
        tuneedit = gtk.GenericCellRenderer()
        panedit = gtk.GenericCellRenderer()
        filteredit = gtk.GenericCellRenderer()
        """

        self.treeview.append_column(gtk.TreeViewColumn("Name", textedit, text=0))
        self.treeview.append_column(gtk.TreeViewColumn("Sample", sampleedit, text=1))
        self.treeview.append_column(gtk.TreeViewColumn("Level", leveledit, samplerobject=2))
        """
        self.treeview.append_column(gtk.TreeViewColumn("Tune", tuneedit))
        self.treeview.append_column(gtk.TreeViewColumn("Pan", panedit))
        self.treeview.append_column(gtk.TreeViewColumn("Filter", filteredit))
        """

        self.scrolledwindow.add(self.treeview)
        self.hpaned.add1(self.scrolledwindow)
        self.hpaned.add2(gtk.DrawingArea())
        vbox.pack_start(self.hpaned)
        self.add(vbox)

        self.queue_draw()
        self.show_all()
예제 #13
0
    def __init__(self):
        self.__gobject_init__()
        self._renderer = gtk.CellRendererCombo()
        self.set_property("mode", self._renderer.get_property("mode"))

        self.text = self._renderer.get_property('text')
        self.editable = self._renderer.get_property('editable')
        self.visible = True
예제 #14
0
def build_combo_cellrenderer(model, cb):
    renderer = gtk.CellRendererCombo()
    if model:
        renderer.set_property("model", model)
    renderer.set_property("editable", True)
    renderer.set_property("text-column", 0)
    renderer.connect("edited", cb)
    return renderer
예제 #15
0
 def __init__(self, *args):
     super(Selection, self).__init__(*args)
     self.renderer = gtk.CellRendererCombo()
     selection_data = gtk.ListStore(str, str)
     for x in self.attrs.get('selection', []):
         selection_data.append(x)
     self.renderer.set_property('model', selection_data)
     self.renderer.set_property('text-column', 1)
예제 #16
0
    def build_dialog(self):
        self.set_default_size(400, 500)
        self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK,
                         gtk.RESPONSE_OK)
        self.set_title("Enable Broadcast")

        self.store = gtk.ListStore(bool, str, str, int, str)
        self.tree = gtk.TreeView(self.store)

        renderer = gtk.CellRendererToggle()
        renderer.connect("toggled", self.on_cell_toggled)
        column = gtk.TreeViewColumn('Broadcast', renderer, active=0)
        column.set_sort_column_id(0)
        self.tree.append_column(column)

        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn('Terminal Name', renderer, text=1)
        column.set_sort_column_id(1)
        self.tree.append_column(column)

        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn('Host', renderer, text=2)
        column.set_sort_column_id(2)
        self.tree.append_column(column)

        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn('Page', renderer, text=3)
        column.set_visible(False)
        self.tree.append_column(column)

        combo_store = gtk.ListStore(str)
        for color in ['blue', 'red', 'green', 'yellow']:
            combo_store.append([color])
        renderer = gtk.CellRendererCombo()
        renderer.set_property('editable', True)
        renderer.set_property('has-entry', True)
        renderer.set_property("text-column", 0)
        renderer.set_property("model", combo_store)
        renderer.connect("edited", self.on_combo_changed)
        column = gtk.TreeViewColumn('Group', renderer, text=4)
        self.tree.append_column(column)

        scroll = gtk.ScrolledWindow()
        scroll.add(self.tree)

        self.vbox.pack_start(scroll, True, True, 0)

        terminals = self.main_window.notebook.get_all_terminals()
        for terminal in terminals:
            label = terminal.label.label.get_text().strip()
            host = None
            if terminal.host:
                host = terminal.host['host']
            page_num = self.main_window.notebook.get_page_by_terminal(terminal)
            self.store.append(
                (terminal.broadcast, label, host, page_num, terminal.group))
        self.show_all()
예제 #17
0
    def __init__(self, library):
        """ Dialog constructor.
        @param library: Dialog parent window, should be library window.
        """
        super(WatchListDialog,
              self).__init__(_("Library watch list"), library,
                             gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
                             (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))

        self.library = library

        self.set_default_response(gtk.RESPONSE_CLOSE)

        # Initialize treeview control showing existing watch directories
        self._treeview = gtk.TreeView(self._create_model())
        self._treeview.set_headers_visible(True)
        self._treeview.get_selection().connect('changed',
                                               self._item_selected_cb)

        dir_renderer = gtk.CellRendererText()
        dir_column = gtk.TreeViewColumn(_("Directory"), dir_renderer)
        dir_column.set_attributes(dir_renderer, text=COL_DIRECTORY)
        self._treeview.append_column(dir_column)

        collection_model = self._create_collection_model()
        collection_renderer = gtk.CellRendererCombo()
        collection_renderer.set_property('model', collection_model)
        collection_renderer.set_property('text-column', COL_COLLECTION)
        collection_renderer.set_property('editable', gtk.TRUE)
        collection_renderer.set_property('has-entry', gtk.FALSE)
        collection_renderer.connect('changed', self._collection_changed_cb,
                                    collection_model)
        collection_column = gtk.TreeViewColumn(_("Collection"),
                                               collection_renderer)
        collection_column.set_cell_data_func(
            collection_renderer, self._treeview_collection_id_to_name)
        self._treeview.append_column(collection_column)

        add_button = gtk.Button(_("_Add"), gtk.STOCK_ADD)
        add_button.connect('clicked', self._add_cb)
        self._remove_button = remove_button = gtk.Button(
            _("_Remove"), gtk.STOCK_REMOVE)
        remove_button.set_sensitive(False)
        remove_button.connect('clicked', self._remove_cb)

        button_box = gtk.VBox()
        button_box.pack_start(add_button, expand=False)
        button_box.pack_start(remove_button, expand=False, padding=2)

        main_box = gtk.HBox()
        main_box.pack_start(self._treeview, padding=2)
        main_box.pack_end(button_box, expand=False)
        self.vbox.pack_start(main_box)

        self.resize(400, 350)
        self.connect('response', self._close_cb)
        self.show_all()
예제 #18
0
    def __init__(self):
        wtree.signal_autoconnect({
            'on_sound_square_toggled': (self.on_sound_toggled, 0),
            'on_sound_sine_toggled': (self.on_sound_toggled, 1),
            'on_sound_noise_toggled': (self.on_sound_toggled, 2),
            'on_sound_click_toggled': (self.on_sound_toggled, 3),
            'on_sound_custom_toggled': (self.on_sound_toggled, -1),
            'on_accented_selection_changed':
            self.on_sound_selection_changed,
            'on_normal_selection_changed':
            self.on_sound_selection_changed,
            'on_pitch_accented_changed':
            self.on_pitch_changed,
            'on_pitch_normal_changed':
            self.on_pitch_changed,
            'on_pitch_format_value':
            self.on_pitch_format_value,
            'on_connect_auto_toggled': (self.on_connect_toggled, True),
            'on_connect_manual_toggled': (self.on_connect_toggled, False),
            'on_connect_add':
            self.on_connect_add,
            'on_connect_remove':
            self.on_connect_remove,
            'on_preferences_delete_event':
            self.on_delete_event,
            'on_preferences_close':
            self.on_close,
        })

        widgets['vbox_filechoosers'].set_sensitive(config.prefs_sound == -1)

        # build JACK connection treeview
        self.treeview_ports = widgets['treeview_connect_ports']
        self.model_ports = gtk.ListStore(str)
        self.treeview_ports.set_model(self.model_ports)
        self.model_avail = gtk.ListStore(str)

        renderer = gtk.CellRendererCombo()
        renderer.set_property('model', self.model_avail)
        renderer.set_property('text-column', 0)
        renderer.set_property('editable', True)
        self.column = gtk.TreeViewColumn(None, renderer, text=0)
        self.treeview_ports.append_column(self.column)

        self.treeview_ports.get_selection().connect(
            'changed', self.on_connect_selection_changed)
        renderer.connect('editing-started', self.on_connect_editing_started)
        renderer.connect('editing-canceled', self.on_connect_editing_canceled)
        renderer.connect('edited', self.on_connect_cell_edited)
        self.model_ports.connect('row-deleted',
                                 lambda w, p: self.update_connect_ports())

        widgets['btn_connect_remove'].set_sensitive(False)
        self.ports_avail = []

        klick.register_methods(self)
예제 #19
0
    def __init__(self, padre= None, editando = False):
        builder = gtk.Builder()
        builder.add_from_file("dlgProduccionTortas.glade")

        self.dialogo = builder.get_object("dialogo")
        self.produccion_id = builder.get_object("produccion_id")
        self.fecha = builder.get_object("fecha")
        self.estado = builder.get_object("estado")
        self.harina_arroba = builder.get_object("harina_arroba")
        self.harina_kg = builder.get_object("harina_kg")
        self.harina_bultos = builder.get_object("harina_bultos")
        self.tree = builder.get_object('tree')
        self.lista = builder.get_object('lista')
        self.tvcolumn2 = builder.get_object('tvcolumn2')
        self.tvcell2 = builder.get_object('tvcell2')
        self.costos = builder.get_object('costos')
        self.statusbar = builder.get_object('statusbar')
        self.agregar_receta_torta = builder.get_object('agregar_receta_torta')
        self.quitar_receta_torta = builder.get_object('quitar_receta_torta')
        self.limpiar_recetas_torta = builder.get_object('limpiar_recetas_torta')
        self.codigo = 0

        # Create a combobox column para empleados
        self.lsmodelo = gtk.ListStore(str)

        self.cellcombo = gtk.CellRendererCombo()

        self.cellcombo.set_property("text-column", 0)
        self.cellcombo.set_property("editable", True)
        self.cellcombo.set_property("has-entry", False)
        self.cellcombo.set_property("model", self.lsmodelo)
        self.tvcolumn5 = gtk.TreeViewColumn("Encargado de la elaboración", self.cellcombo, text=5)
        self.tree.append_column(self.tvcolumn5)

        self.imprimir = builder.get_object('imprimir')
        self.aceptar = builder.get_object('aceptar')
        self.salir = builder.get_object('salir')

        self.dialogo.connect("destroy", self.on_dialogo_destroy)
        self.tvcell2.connect( 'edited', self.on_tvcell2_edited_cb, self.lista )
        self.cellcombo.connect("edited", self.on_cellcombo_edited)
        self.agregar_receta_torta.connect("clicked", self.on_agregar_receta_torta_clicked)
        self.quitar_receta_torta.connect("clicked", self.on_quitar_receta_torta_clicked)
        self.limpiar_recetas_torta.connect("clicked", self.on_limpiar_recetas_torta_clicked)
        self.imprimir.connect("clicked", self.on_imprimir_clicked)
        self.aceptar.connect("clicked", self.on_aceptar_clicked)
        self.salir.connect("clicked", self.on_salir_clicked)

        self.padre = padre
        if padre is None:
            self.padre = self.dialogo
        else:
            self.padre = self.padre.padre

        self.cargar_combo()
        self.dialogo.show()
예제 #20
0
    def __init__(self):
        gtk.Frame.__init__(self)

        scrolledWindow = gtk.ScrolledWindow()
        scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        treeview = self.treeview = gtk.TreeView()

        model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                              gobject.TYPE_PYOBJECT)
        treeview.set_model(model)
        treeview.connect("motion-notify-event", self.treeview_mouse_over)

        key_renderer = gtk.CellRendererText()
        key_renderer.set_property("editable", False)

        column1 = gtk.TreeViewColumn("Name", key_renderer, text=0)
        column1.set_cell_data_func(key_renderer, self.key_data_func)
        column1.set_property("min-width", 75)

        entry_renderer = gtk.CellRendererText()
        entry_renderer.connect("edited", self.entry_edited)
        entry_renderer.connect("editing-started", self.entry_edit_start)

        combo_renderer = gtk.CellRendererCombo()
        combo_renderer.set_property("text-column", 0)
        combo_renderer.connect("edited", self.combo_selected)
        combo_renderer.connect("editing-started", self.combo_edit_start)

        column2 = gtk.TreeViewColumn("Value", entry_renderer, text=1)
        column2.pack_start(combo_renderer)
        column2.set_attributes(combo_renderer, text=1)
        column2.set_cell_data_func(entry_renderer, self.entry_data_func)
        column2.set_cell_data_func(combo_renderer, self.combo_data_func)
        column2.set_property("expand", True)
        column2.set_property("min-width", 75)

        icon_renderer = gtk.CellRendererPixbuf()

        column3 = gtk.TreeViewColumn("", icon_renderer)
        column3.set_cell_data_func(icon_renderer, self.icon_data_func)

        treeview.append_column(column1)
        treeview.append_column(column2)
        treeview.append_column(column3)

        scrolledWindow.add(treeview)

        label = gtk.Label()
        label.set_markup("<b>Attributes</b>")

        self.set_label_widget(label)
        self.set_shadow_type(gtk.SHADOW_NONE)
        self.add(scrolledWindow)
예제 #21
0
파일: utils.py 프로젝트: zuccon/museek-plus
def InitialiseColumns(treeview, *args):
    i = 0
    cols = []
    for c in args:
        if c[2] == "text":
            renderer = gtk.CellRendererText()
            column = gtk.TreeViewColumn(c[0], renderer, text=i)
        elif c[2] == "colored":
            renderer = gtk.CellRendererText()
            column = gtk.TreeViewColumn(c[0],
                                        renderer,
                                        text=i,
                                        foreground=c[3][0],
                                        background=c[3][1])
        elif c[2] == "edit":
            renderer = gtk.CellRendererText()
            renderer.set_property('editable', True)
            column = gtk.TreeViewColumn(c[0], renderer, text=i)
        elif c[2] == "combo":
            renderer = gtk.CellRendererCombo()
            renderer.set_property('text-column', 0)
            renderer.set_property('editable', True)
            column = gtk.TreeViewColumn(c[0], renderer, text=i)
        elif c[2] == "progress":
            renderer = gtk.CellRendererProgress()
            column = gtk.TreeViewColumn(c[0], renderer, value=i)
        elif c[2] == "toggle":
            renderer = gtk.CellRendererToggle()
            column = gtk.TreeViewColumn(c[0], renderer, active=i)
        else:
            renderer = gtk.CellRendererPixbuf()
            column = gtk.TreeViewColumn(c[0], renderer, pixbuf=0)
        if c[1] == -1:
            column.set_resizable(False)
            column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
        else:
            column.set_resizable(True)
            if c[1] == 0:
                column.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
            else:
                column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
                column.set_fixed_width(c[1])
            column.set_min_width(0)
        if len(c) > 3 and type(c[3]) is not list:
            column.set_cell_data_func(renderer, c[3])
        column.set_reorderable(True)
        column.set_widget(gtk.Label(c[0]))
        column.get_widget().show()
        treeview.append_column(column)
        cols.append(column)
        i += 1
    return cols
예제 #22
0
파일: Settings.py 프로젝트: chubiei/compiz
    def GetColumn(self, num):
        self.Num = num
        cell = gtk.CellRendererCombo()
        column = gtk.TreeViewColumn(self.Setting.ShortDesc, cell, text=num)
        model = gtk.ListStore(str)
        for property, value in [("model", model), ("text_column", 0),
                                ("editable", False), ("has_entry", False)]:
            cell.set_property(property, value)
        cell.connect("edited", self._CellEdited)
        for item, i in self.SortedItems:
            model.append([item])

        return (str, column)
예제 #23
0
    def __init__(self):
        gtk.ScrolledWindow.__init__(self)
        Signalizable.__init__(self)

        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        units = gtk.ListStore(str)
        units.append([_("millimeters")])
        units.append([_("inches")])
        units.append([_("pixels")])

        self.liststore = gtk.ListStore(str, int, str)

        treeview = gtk.TreeView(self.liststore)
        treeview.set_size_request(-1, 100)
        treeview.set_rules_hint(True)
        treeview.set_grid_lines(True)
        self.add(treeview)

        cell = gtk.CellRendererText()
        cell.connect("edited", self.title_edited)
        cell.set_property("editable", True)
        column = gtk.TreeViewColumn(_("Title"))
        column.pack_start(cell, True)
        column.set_attributes(cell, text=COLUMN_TITLE)
        treeview.append_column(column)
        treeview.set_search_column(COLUMN_TITLE)

        adjustment = gtk.Adjustment(0, 0, 100, 1)
        cell = gtk.CellRendererSpin()
        cell.connect("edited", self.width_edited)
        cell.set_property("editable", True)
        cell.set_property("adjustment", adjustment)
        cell.set_property("xalign", 1.0)
        column = gtk.TreeViewColumn(_("Width"))
        column.pack_start(cell, True)
        column.set_attributes(cell, text=COLUMN_WIDTH)
        treeview.append_column(column)

        cell = gtk.CellRendererCombo()
        cell.set_property("editable", True)
        cell.set_property("has-entry", False)
        cell.set_property("model", units)
        cell.set_property("text-column", 0)
        column = gtk.TreeViewColumn(_("Unit"))
        column.pack_start(cell, True)
        column.set_attributes(cell, text=COLUMN_UNIT)
        treeview.append_column(column)

        self.install_signals()
예제 #24
0
    def _prepare_treeview_with_headcolumn_list(self, liststore):
        '''
		Preparation of the treeview element, that displays the columns of the table
		:param liststore: model for current treeview
		:return: the treeview
		'''
        treeview = gtk.TreeView(liststore)

        # 1. Column - Title
        cell = gtk.CellRendererText()
        cell.set_property('editable', True)
        column = gtk.TreeViewColumn(_('Title'), cell, text=self.Col.title)
        column.set_min_width(120)
        treeview.append_column(column)
        cell.connect('edited', self.on_cell_changed, liststore, self.Col.title)
        cell.connect('editing-started', self.on_cell_editing_started,
                     liststore, self.Col.title)

        # 2. Column - Wrap Line
        cell = gtk.CellRendererToggle()
        cell.connect('toggled', self.on_wrap_toggled, liststore,
                     self.Col.wrapped)
        column = gtk.TreeViewColumn(_('Auto\nWrap'), cell)  # T: table header
        treeview.append_column(column)
        column.add_attribute(cell, 'active', self.Col.wrapped)

        # 3. Column - Alignment
        store = gtk.ListStore(str, str, str)
        store.append(COLUMNS_ALIGNMENTS['left'])
        store.append(COLUMNS_ALIGNMENTS['center'])
        store.append(COLUMNS_ALIGNMENTS['right'])

        column = gtk.TreeViewColumn(_('Align'))  # T: table header
        cellicon = gtk.CellRendererPixbuf()
        column.pack_start(cellicon)
        column.add_attribute(cellicon, 'stock-id', self.Col.alignicon)

        cell = gtk.CellRendererCombo()
        cell.set_property('model', store)
        cell.set_property('has-entry', False)
        cell.set_property('text-column', 2)
        cell.set_property('width', 50)
        cell.set_property('editable', True)
        column.pack_start(cell)
        column.add_attribute(cell, 'text', self.Col.aligntext)
        cell.connect('changed', self.on_alignment_changed, liststore)
        treeview.append_column(column)

        return treeview
예제 #25
0
    def __init__(self):
        UITricks.__init__(self, 'ui/config.glade', 'config_dialog')
        self.on_flickr_enabled_handle_toggled()
        self.on_webshots_enabled_handle_toggled()
        self.on_autodownload_bool_handle_toggled()
        self.on_rotate_bool_handle_toggled()
        self.on_wallpaper_use_script_handle_toggled()

        cell = gtk.CellRendererToggle()
        cell.set_property('activatable', True)
        column = gtk.TreeViewColumn('', cell, active=3)
        self.flickr_rules.append_column(column)
        cell.connect('toggled', self.on_rule_toggled, 3)

        for index, value in enumerate([_('Album'), _('Tags'), _('User')]):
            cell = gtk.CellRendererText()
            cell.set_property('editable', True)
            column = gtk.TreeViewColumn(value, cell, text=index)
            column.set_resizable(True)
            self.flickr_rules.append_column(column)
            cell.connect('edited', self.on_cell_edited, index)

        cell = gtk.CellRendererCombo()
        cell.set_property('has-entry', False)
        combo_model = gtk.ListStore(str)
        combo_model.append(('Interestingness', ))
        combo_model.append((_('Date'), ))
        cell.set_property('model', combo_model)
        cell.set_property('text-column', 0)
        cell.set_property('editable', True)
        column = gtk.TreeViewColumn(_('Sort'), cell, text=4)
        self.flickr_rules.append_column(column)
        cell.connect('edited', self.on_cell_edited, 4)
        self.rotate_interval.get_model().clear()

        for time in sorted(ROTATION_CONSTS.keys()):
            self.rotate_interval.append_text(ROTATION_CONSTS[time])
        self.wallpaper_widgets = dict(
            gnome=self.wallpaper_use_gnome,
            kde=self.wallpaper_use_kde,
            xfce=self.wallpaper_use_xfce,
            compiz_wallpaper=self.wallpaper_use_compiz_wallpaper,
            script=self.wallpaper_use_script)
        self.notebook.drag_dest_set(
            gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT
            | gtk.DEST_DEFAULT_DROP, [('text/plain', 0, 0),
                                      ('text/uri-list', 0, 1)],
            gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
예제 #26
0
    def board_custom_prefs_dialog(self):
        '''
        Display board pref dialog.
        '''
        def combo_value(treeviewcolumn, cell, model, iter):
            cell.set_property('text', model.get_value(iter, 2))
            cell.set_property('model', model.get_value(iter, 3))
            return

        def on_combo_value_changed(combo, path, iter):
            combo_store = self.store_customs_prefs[path][3]
            self.set_pref(self.store_customs_prefs[path][1],
                          combo_store.get_value(iter, 1))
            self.store_customs_prefs[path][2] = combo_store.get_value(iter, 0)

        def on_reponse_event(dialog, reponse):
            dialog.destroy()

        dialog = gtk.Dialog('Arduino customs preferences',
                            buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        dialog.connect('response', on_reponse_event)
        dialog.set_default_size(400, 400)

        scroll = gtk.ScrolledWindow()

        view = gtk.TreeView(self.store_customs_prefs)

        key_column = gtk.TreeViewColumn('Key')
        view.append_column(key_column)
        key_render = gtk.CellRendererText()
        key_column.pack_start(key_render, True)
        key_column.add_attribute(key_render, 'text', 0)

        value_render = gtk.CellRendererCombo()
        value_render.set_property("editable", True)
        value_render.set_property("text-column", 0)
        value_render.set_property("has-entry", False)
        value_render.connect("changed", on_combo_value_changed)
        value_column = gtk.TreeViewColumn('Value', value_render, text=2)
        value_column.set_cell_data_func(value_render, combo_value)
        view.append_column(value_column)

        scroll.add(view)
        vbox = dialog.get_content_area()
        vbox.pack_start(scroll)

        dialog.show_all()
예제 #27
0
파일: eventdb.py 프로젝트: rijilks/scbdo
 def mkview(self):
     """Create and return view object for the model."""
     if self.view is not None:
         return self.view
     v = gtk.TreeView(self.model)
     v.set_reorderable(True)
     v.set_enable_search(False)
     v.set_rules_hint(True)
     v.connect('key-press-event', self.__view_key)
     v.show()
     uiutil.mkviewcoltxt(v,
                         'No.',
                         COL_EVNO,
                         self.__editcol_cb,
                         editcb=self.__editstart_cb)
     uiutil.mkviewcoltxt(v,
                         'Prefix',
                         COL_PREFIX,
                         self.__editcol_cb,
                         expand=True,
                         editcb=self.__editstart_cb)
     uiutil.mkviewcoltxt(v,
                         'Info',
                         COL_INFO,
                         self.__editcol_cb,
                         expand=True,
                         editcb=self.__editstart_cb)
     uiutil.mkviewcoltxt(v,
                         'Ser',
                         COL_SERIES,
                         self.__editcol_cb,
                         editcb=self.__editstart_cb)
     i = gtk.CellRendererCombo()
     i.set_property('editable', True)
     m = gtk.ListStore(gobject.TYPE_STRING)
     for race in self.racetypes:
         m.append([race])
     i.set_property('model', m)
     i.set_property('text-column', 0)
     i.connect('edited', self.__editcol_cb, COL_TYPE)
     i.connect('editing-started', self.__editstart_cb, 'combo')
     j = gtk.TreeViewColumn('Type', i, text=COL_TYPE)
     j.set_min_width(90)
     v.append_column(j)
     self.view = v
     return self.view
예제 #28
0
 def build_combo_column(self, column_name, column_id, value_list):
     """Function to build the columns with selection from a list"""
     # COMBOBOX CELL
     combo_list = gtk.ListStore(str)
     for value in value_list:
         combo_list.append([value])
     rendererCombo = gtk.CellRendererCombo()
     rendererCombo.set_properties(model=combo_list, editable=True)
     rendererCombo.set_property("has-entry", False)
     rendererCombo.set_property("text-column", 0)
     rendererCombo.connect("edited", self.on_combo_edit, column_id)
     # COMBOBOX COLUMN
     column = gtk.TreeViewColumn(column_name)
     column.pack_start(rendererCombo, False)
     column.add_attribute(rendererCombo, "text", column_id)
     column.add_attribute(rendererCombo, "visible", 4)
     self.config_app_view.append_column(column)
예제 #29
0
    def __init__(self, widget = None):
        self.__gobject_init__()
        self._value = None
        self._text_renderer = gtk.CellRendererText()
        self._text_renderer.set_property('editable', True)
        self._text_renderer.connect('edited', self.edited_handler)

        self._toggle_renderer = gtk.CellRendererToggle()
        self._toggle_renderer.set_property('xalign', 0.0)
        self._toggle_renderer.set_property('activatable', True)

        self._combo_renderer = gtk.CellRendererCombo()
        self._combo_renderer.set_property('editable', True)
        self._combo_renderer.set_property('has-entry', False)
        self._combo_renderer.set_property('text-column', 0)
        self._combo_renderer.connect('edited', self.edited_handler)

        self._cur_renderer = None
예제 #30
0
파일: scherror.py 프로젝트: jhill1/stk
    def __init__(self, parent, gladefile, schema_file, schematron_file):
        self.parent = parent
        self.gladefile = gladefile
        self.schema_file = schema_file
        self.schematron_file = schematron_file
        self.errlist_type = 0
        self.listview = None

        self.listwindow = self.parent.gui.get_widget("errListWindow")
        self.listview = self.parent.gui.get_widget("sch_err_list")

        if self.listwindow is None or self.listview is None:
            raise Exception("Could not find the error list widgets")

        self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
        self.cellcombo = gtk.CellRendererCombo()
        self.cellcombo.set_property("model", self.model)
        self.cellcombo.set_property("editable", False)

        column_renderer = gtk.CellRendererText()
        column_renderer.set_property("editable", False)
        column_xpath = gtk.TreeViewColumn("Element", column_renderer, text=0)
        column_error = gtk.TreeViewColumn("Error", column_renderer, text=1)

        self.listview.append_column(column_xpath)
        self.listview.append_column(column_error)

        column_xpath.set_property("expand", True)
        column_xpath.set_resizable(True)
        column_xpath.set_property("min-width", 75)

        column_error.set_property("expand", True)
        column_error.set_resizable(True)
        column_error.set_property("min-width", 75)

        # Set adjustment parameters for the list view
        self.listview.set_model(self.model)
        self.listview.connect("row_activated", self.on_xml_row_activate)

        # User can only select one error at a time to go to.
        self.listview.get_selection().set_mode(gtk.SELECTION_SINGLE)

        self.listview.hide()
        self.listwindow.hide()