python类ListStore()的实例源码

pyspc_gui.py 文件源码 项目:pyspc 作者: carlosqsilva 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def add_treeview(self):
        num_columns = [float for x in range(len(self.data.columns))]

        liststore = Gtk.ListStore(*num_columns)
        for ref in self.data.values.tolist():
            liststore.append(ref)

        treeview = Gtk.TreeView.new_with_model(liststore)
        for i, column_title in enumerate(self.data.columns):
            renderer = Gtk.CellRendererText()
            column = Gtk.TreeViewColumn(column_title, renderer, text=i)
            treeview.append_column(column)

        self.scrollable_treelist = Gtk.ScrolledWindow()
        self.scrollable_treelist.add(treeview)
        self.scrollable_treelist.set_vexpand(True)
        self.scrollable_treelist.set_hexpand(True)
        self.verticalbox.pack_start(self.scrollable_treelist, True, True, 0)
        self.verticalbox.show_all()
main_window.py 文件源码 项目:MokaPlayer 作者: vedard 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init_txt_goto(self):
        completion = Gtk.EntryCompletion()
        store = Gtk.ListStore(str)

        artists_name = {x.Name for x in ArtistsPlaylist().collections()}
        albums_name = {x.Name for x in AlbumsPlaylist().collections()}

        for x in artists_name.union(albums_name):
            store.append([x])

        completion.set_model(store)
        completion.set_text_column(0)
        completion.set_inline_completion(True)
        completion.set_match_func(self.__txt_goto_match_func)
        completion.set_inline_selection(True)
        completion.connect('match_selected', lambda x, y, z: self.__manage_goto())
        self.txt_goto.set_completion(completion)
main_window.py 文件源码 项目:MokaPlayer 作者: vedard 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __create_model(self):
        self.logger.info('Creating ListStore')
        start = time.perf_counter()

        model = AdapterSong.create_store()
        order = AbstractPlaylist.OrderBy[self.userconfig['grid']['sort']['field']]
        desc = self.userconfig['grid']['sort']['desc']
        songs = self.current_playlist.collections(order, desc)

        for row in songs:
            model.insert_with_valuesv(-1, AdapterSong.create_col_number(), AdapterSong.create_row(row))

        GObject.idle_add(lambda: self.__create_model_finished(model))

        end = time.perf_counter()
        self.logger.info('ListStore created in {:.3f} seconds'.format(end - start))
treeviews.py 文件源码 项目:bokken 作者: thestr4ng3r 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, core, textviews):
        self.store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str, str)
        super(TreeViews,self).__init__(self.store)

        self.uicore = core
        self.textviews = textviews

        self.set_rules_hint(True)
        self.set_has_tooltip(True)

        # Connect right click popup search menu
        self.popup_handler = self.connect('button-press-event', self.popup_menu)
        self.popup_handler = self.connect('row-activated', self.popup_menu)

        self.fcn_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('function.png'))
        self.bb_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('block.png'))
        self.data_sec_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('data-sec.png'))
        self.exp_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('export.png'))
        self.imp_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('import.png'))
playlist_manager.py 文件源码 项目:chromecast-player 作者: wa4557 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, playlist, enable_web, transcoder, probe, preferred_transcoder, counter):
        self.win = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)

        theme = Gtk.IconTheme.get_default()
        self.playimage = theme.load_icon("media-playback-start", 16,0)
        self.store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, int, int, str, str, str, str)
        self.selection_index = None 
        self.create_model(playlist)
        if counter:
            self.store[counter][0] = self.playimage
        self.playlist_counter = None
        self.play_now = False
        self.playlist_changed = False
        self.double_clicked = False
        self.drag_index = None
        self.transcoder = transcoder
        self.number_clicked = 0
        self.double_clicked_index = None
        self.probe = probe
        self.preferred_transcoder = preferred_transcoder
        self.enable_web = enable_web
        self.show_image = True
        self.sorted_index = None
ancestrygramplet.py 文件源码 项目:AncestryCitations 作者: tecknicaltom 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __create_gui(self):
        """
        Create and display the GUI components of the gramplet.
        """
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.model = Gtk.ListStore(object, str, int)
        view = Gtk.TreeView(self.model)
        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(_("Person"), renderer, text=1)
        view.append_column(column)
        renderer = Gtk.CellRendererText()
        renderer.set_property('editable', True)
        renderer.connect('edited', self.__cell_edited)
        column = Gtk.TreeViewColumn(_("ID"), renderer, text=2)
        view.append_column(column)

        vbox.pack_start(view, expand=True, fill=True, padding=0)
        return vbox
ControlsGTK.py 文件源码 项目:pycam 作者: SebKuzminsky 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, choices, change_handler=None):
        self.model = gtk.ListStore(GObject.TYPE_STRING)
        self._values = []
        for label, value in choices:
            self.model.append((label,))
            self._values.append(value)
        renderer = gtk.CellRendererText()
        self.control = gtk.ScrolledWindow()
        self.control.show()
        self._treeview = gtk.TreeView(self.model)
        self._treeview.show()
        self.control.add(self._treeview)
        self.control.set_shadow_type(gtk.ShadowType.ETCHED_OUT)
        self.control.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
        # Sadly there seems to be no way to adjust the size of the ScrolledWindow to its content.
        # The default size of the ScrolledWindow is too small (making it hard to select the model).
        self.control.set_size_request(200, -1)
        column = gtk.TreeViewColumn()
        column.pack_start(renderer, expand=False)
        column.set_attributes(renderer, text=0)
        self._treeview.append_column(column)
        self._treeview.set_headers_visible(False)
        self._selection = self._treeview.get_selection()
        self._selection.set_mode(gtk.SelectionMode.MULTIPLE)
        self.connect("changed", change_handler, self._selection)
comboboxlist.py 文件源码 项目:google-tasks-indicator 作者: atareao 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def create_window(self):
        self.dialog = Gtk.Dialog(None, None, Gtk.DialogFlags.MODAL) 
        self.dialog.set_decorated(False)
        #
        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_can_focus(False) 
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
        self.dialog.vbox.pack_start(scrolledwindow, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK,0)
        #
        self.store = Gtk.ListStore(str)
        for value in self.values:
            self.store.append([value])
        self.tree = Gtk.TreeView(self.store)
        self.tree.set_headers_visible(False)
        self.tree.set_can_focus(False) 
        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(title=None,cell_renderer=renderer, text=0)
        self.tree.append_column(column)
        #
        scrolledwindow.add(self.tree)
        self.tree.connect('focus-out-event',self.on_focus_out)
        self.dialog.connect('focus-out-event',self.on_focus_out)
        self.tree.connect('cursor-changed',self.on_cursor_changed)
        self.dialog.show_all()
theme_creator.py 文件源码 项目:XFWM_theme_creator 作者: Sjc1000 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        Gtk.ScrolledWindow.__init__(self)
        self.view = Gtk.IconView()
        self.list = Gtk.ListStore(Pixbuf, str)
        self.view.set_model(self.list)
        self.view.set_pixbuf_column(0)
        self.view.set_text_column(1)
        self.view.set_activate_on_single_click(True)
        self.view.set_item_width(100)

        self.menu = Gtk.Menu()
        copy = Gtk.MenuItem('Copy')
        copy.connect('activate', self.copy)
        paste = Gtk.MenuItem('Paste')
        paste.connect('activate', self.paste)
        self.menu.append(copy)
        self.menu.append(paste)

        self.view.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
        self.view.connect('button-press-event', self.show_menu)

        self.view.set_vexpand(True)
        self.view.set_hexpand(True)
        self.add(self.view)
        self.view.connect('item-activated', self.row_activated)
theme_creator.py 文件源码 项目:XFWM_theme_creator 作者: Sjc1000 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        Gtk.ScrolledWindow.__init__(self)
        self.list = Gtk.ListStore(str, bool)
        self.view = Gtk.TreeView(self.list)
        self.view.set_hexpand(True)
        text_renderer = Gtk.CellRendererText()
        check_renderer = Gtk.CellRendererToggle()
        name_column = Gtk.TreeViewColumn('Gtk color list', text_renderer, text=0)
        check_column = Gtk.TreeViewColumn('', check_renderer, active=1)
        self.view.append_column(check_column)
        self.view.append_column(name_column)
        self.view.connect('row-activated', self.row_activated)
        self.add(self.view)

        names = ['active_text_color', 'inactive_text_color',
                 'active_text_shadow_color', 'inactive_text_shadow_color',
                 'active_border_color', 'inactive_border_color',
                 'active_color_1', 'active_color_2', 'active_highlight_1',
                 'active_highlight_2', 'active_mid_1', 'active_mid_2',
                 'active_shadow_1', 'active_shadow_2', 'inactive_color_1',
                 'inactive_color_2', 'inactive_highlight_1',
                 'inactive_highlight_2', 'inactive_mid_1', 'inactive_mid_2',
                 'inactive_shadow_1', 'inactive_shadow_2']
        for name in names:
            self.list.append([name, False])
test.py 文件源码 项目:plotcommander 作者: FilipDominec 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self):
        super(CellRendererFadeWindow, self).__init__(title="CellRendererFade Example")

        self.set_default_size(200, 200)
        self.liststore = Gtk.ListStore(str, str)
        self.liststore.append(["New", Gtk.STOCK_NEW])
        self.liststore.append(["Open", Gtk.STOCK_OPEN])
        self.liststore.append(["Save", Gtk.STOCK_SAVE])

        treeview = Gtk.TreeView(model=self.liststore)
        renderer_text = Gtk.CellRendererText()
        column_text = Gtk.TreeViewColumn("Text", renderer_text, text=0)
        treeview.append_column(column_text)

        renderer_pixbuf = CellRenderFade(param=0.001)
        column_pixbuf = Gtk.TreeViewColumn("Image", renderer_pixbuf, stock_id=1)
        treeview.append_column(column_pixbuf)
        self.add(treeview)
window.py 文件源码 项目:ssh-manager 作者: Doka-NT 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(
            self, manager: Manager,
            window_config: Window,
            command_ssh: AbstractCommand,
            command_edit: AbstractCommand
    ):
        self._listbox = None
        self._frame = None
        self._scrollable = None
        self._btn_reload = None
        self._btn_settings = None
        self._list_store = Gtk.ListStore(str)

        self.__command_ssh = command_ssh
        self.__command_edit = command_edit
        self._manager = manager
        self._window_config = window_config
oneconfviews.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, icons):
        super(OneConfViews, self).__init__()
        model = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING,
            GObject.TYPE_STRING)
        model.set_sort_column_id(self.COL_HOSTNAME, Gtk.SortType.ASCENDING)
        model.set_sort_func(self.COL_HOSTNAME, self._sort_hosts)
        self.set_model(model)
        self.set_headers_visible(False)
        self.col = Gtk.TreeViewColumn('hostname')

        hosticon_renderer = Gtk.CellRendererPixbuf()
        hostname_renderer = Gtk.CellRendererText()
        self.col.pack_start(hosticon_renderer, False)
        self.col.add_attribute(hosticon_renderer, 'pixbuf', self.COL_ICON)
        self.col.pack_start(hostname_renderer, True)
        self.col.add_attribute(hostname_renderer, 'text', self.COL_HOSTNAME)
        self.append_column(self.col)
        self.current_hostid = None
        self.hostids = []

        # TODO: load the dynamic one (if present), later
        self.default_computer_icon = icons.load_icon("computer", 22, 0)

        self.connect("cursor-changed", self.on_cursor_changed)
plantlist.py 文件源码 项目:funky 作者: giannitedesco 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, plants = (),
                show_text = False,
                selectable = True):
        super(PlantList, self).__init__()

        s = Gtk.ListStore(object, Pixbuf, str)

        self.set_model(s)
        self.set_pixbuf_column(1)
        if show_text:
            self.set_text_column(2)

        self.set_spacing(2)
        self.set_row_spacing(2)
        self.set_column_spacing(2)
        self.set_item_padding(2)
        self.set_item_width(40)

        if not selectable:
            self.set_selection_mode(Gtk.SelectionMode.NONE)

        self.set_plants(plants)
common.py 文件源码 项目:aniwall 作者: worron 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def build_store(self):
        """Build store for Gtk treeview"""
        return Gtk.ListStore(*[item.get("type") for item in self.data])
recipe-578774.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self):

        Gtk.Window.__init__(self, title='My Window Title')
        self.connect('delete-event', Gtk.main_quit)        

        store = Gtk.ListStore(str, str, str, str)
        self.populate_store(store)

        self.treeview = Gtk.TreeView(model=store)

        renderer = Gtk.CellRendererText()

        column_catalog = Gtk.TreeViewColumn('Catalog Name', renderer, text=0)
        column_catalog.set_sort_column_id(0)        
        self.treeview.append_column(column_catalog)

        column_dbname = Gtk.TreeViewColumn('Database Name', renderer, text=1)
        column_dbname.set_sort_column_id(1)
        self.treeview.append_column(column_dbname)

        column_charset = Gtk.TreeViewColumn('Character Set', renderer, text=2)
        column_charset.set_sort_column_id(2)
        self.treeview.append_column(column_charset)

        column_collation = Gtk.TreeViewColumn('Collation', renderer, text=3)
        column_collation.set_sort_column_id(3)
        self.treeview.append_column(column_collation)

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_policy(
            Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled_window.add(self.treeview)
        scrolled_window.set_min_content_height(200)

        self.add(scrolled_window)
        self.show_all()

    # Add data to ListStore
AddWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def get_combobox(self):
        """
        @description: get the combobox of the toolbar

        @return: a Gtk.Combobox
        """
        # the data in the model, of type string
        listmodel = Gtk.ListStore(str)
        # append the data in the model
        listmodel.append(['All'])
        listmodel.append(['External'])
        listmodel.append(['Internal'])
        listmodel.append(['Modules'])

        # a combobox to see the data stored in the model
        combobox = Gtk.ComboBox(model=listmodel)
        combobox.set_tooltip_text("What type of command to add?")

        # a cellrenderer to render the text
        cell = Gtk.CellRendererText()

        # pack the cell into the beginning of the combobox, allocating
        # no more space than needed
        combobox.pack_start(cell, False)
        # associate a property ("text") of the cellrenderer (cell) to a column (column 0)
        # in the model used by the combobox
        combobox.add_attribute(cell, "text", 0)

        # the first row is the active one by default at the beginning
        combobox.set_active(0)

        # connect the signal emitted when a row is selected to the callback function
        combobox.connect("changed", self.on_combochanged)
        return combobox

    # callback function attach to the combobox
InternalWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __get_combobox(self, store, iter):
        """
        @description: get the combobox of the toolbar

        @return: a Gtk.Combobox
        """
        # the data in the model, of type string
        listmodel = Gtk.ListStore(str)
        # append the data in the model
        self.dic = {}
        self.dic[0] = 'time'
        listmodel.append(['time'])
        self.dic[1] = 'power'
        listmodel.append(['power'])
        self.dic[2] = 'clipboard'
        listmodel.append(['clipboard'])

        selected = 0
        if iter is not None:
            for i in range(len(self.dic)):
                if self.dic[i] == store[iter][1]:
                    selected = i

        # a combobox to see the data stored in the model
        combobox = Gtk.ComboBox(model=listmodel)
        combobox.set_tooltip_text("Which internal command to choose" + '?')

        # a cellrenderer to render the text
        cell = Gtk.CellRendererText()

        # pack the cell into the beginning of the combobox, allocating
        # no more space than needed
        combobox.pack_start(cell, False)
        # associate a property ("text") of the cellrenderer (cell) to a column (column 0)
        # in the model used by the combobox
        combobox.add_attribute(cell, "text", 0)

        # the first row is the active one by default at the beginning
        combobox.set_active(selected)

        return combobox
SetupWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 46 收藏 0 点赞 0 评论 0
def __get_combobox(self):
        """
        @description: get the combobox of the toolbar

        @return: a Gtk.Combobox
        """
        # the data in the model, of type string
        listmodel = Gtk.ListStore(str)
        # append the data in the model
        selected = 4
        i = 0
        self.language_list = ['en-AU', 'en-CA', 'en-GB', 'en-IN', 'en-US']
        for language_name in self.language_list:
            listmodel.append([language_name])
            if language_name == self.locale:
                selected = i
            i += 1

        # a combobox to see the data stored in the model
        combobox = Gtk.ComboBox(model=listmodel)
        combobox.set_tooltip_text("What format to choose?")

        # a cellrenderer to render the text
        cell = Gtk.CellRendererText()

        # pack the cell into the beginning of the combobox, allocating
        # no more space than needed
        combobox.pack_start(cell, False)
        # associate a property ("text") of the cellrenderer (cell) to a column (column 0)
        # in the model used by the combobox
        combobox.add_attribute(cell, "text", 0)

        # the first row is the active one by default at the beginning
        combobox.set_active(selected)

        # connect the signal emitted when a row is selected to the callback function
        combobox.connect("changed", self.on_combochanged)
        return combobox
SetupWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __get_rate_combobox(self):
        """
        @description: get the sample rate combobox of the toolbar

        @return: a Gtk.Combobox
        """
        # the data in the model, of type string
        listmodel = Gtk.ListStore(int)
        # append the data in the model
        selected = 0
        i = 0
        self.rate_list = [8000, 16000]
        for rate_name in self.rate_list:
            listmodel.append([rate_name])
            if rate_name == self.audio_rate:
                selected = i
            i += 1

        # a combobox to see the data stored in the model
        rate_combobox = Gtk.ComboBox(model=listmodel)
        rate_combobox.set_tooltip_text("Set Sampling Rate")

        # a cellrenderer to render the text
        rate_cell = Gtk.CellRendererText()

        # pack the cell into the beginning of the combobox, allocating
        # no more space than needed
        rate_combobox.pack_start(rate_cell, False)
        # associate a property ("text") of the cellrenderer (cell) to a column (column 0)
        # in the model used by the combobox
        rate_combobox.add_attribute(rate_cell, "text", 0)

        # the first row is the active one by default at the beginning
        rate_combobox.set_active(selected)

        # connect the signal emitted when a row is selected to the callback function
        rate_combobox.connect("changed", self.on_rate_combochanged)
        return rate_combobox
SetupWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __get_speaker_combobox(self):
        """
        @description: get the speaker combobox of the toolbar

        @return: a Gtk.Combobox
        """
        # the data in the model, of type string
        listmodel = Gtk.ListStore(str)
        # append the data in the model
        selected = 0
        i = 0
        self.speaker_list = ['Mama (Male)', 'His Wife (Female)']
        for speaker_name in self.speaker_list:
            listmodel.append([speaker_name])
            if speaker_name == self.speaker:
                selected = i
            i += 1

        # a combobox to see the data stored in the model
        speaker_combobox = Gtk.ComboBox(model=listmodel)
        speaker_combobox.set_tooltip_text("Whose speaker to choose?")

        # a cellrenderer to render the text
        speaker_cell = Gtk.CellRendererText()

        # pack the cell into the beginning of the combobox, allocating
        # no more space than needed
        speaker_combobox.pack_start(speaker_cell, False)
        # associate a property ("text") of the cellrenderer (cell) to a column (column 0)
        # in the model used by the combobox
        speaker_combobox.add_attribute(speaker_cell, "text", 0)

        # the first row is the active one by default at the beginning
        speaker_combobox.set_active(selected)

        # connect the signal emitted when a row is selected to the callback function
        speaker_combobox.connect("changed", self.on_speaker_combochanged)
        return speaker_combobox
profile_switcher.py 文件源码 项目:sc-controller 作者: kozec 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup_widgets(self):
        # Create
        self._icon = Gtk.Image()
        self._model = Gtk.ListStore(str, object, str)
        self._combo = Gtk.ComboBox.new_with_model(self._model)
        self._box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 0)
        self._savebutton = None
        self._switch_to_button = None

        # Setup
        rend1 = Gtk.CellRendererText()
        rend2 = Gtk.CellRendererText()
        self._icon.set_margin_right(10)
        self._combo.pack_start(rend1, True)
        self._combo.pack_start(rend2, False)
        self._combo.add_attribute(rend1, "text", 0)
        self._combo.add_attribute(rend2, "text", 2)
        self._combo.set_row_separator_func(
            lambda model, iter : model.get_value(iter, 1) is None and model.get_value(iter, 0) == "-" )
        self.update_icon()

        # Signals
        self._combo.connect('changed', self.on_combo_changed)
        self.connect("button_press_event", self.on_button_press)

        # Pack
        self._box.pack_start(self._icon, False, True, 0)
        self._box.pack_start(self._combo, True, True, 0)
        self.add(self._box)
gui_resolver.py 文件源码 项目:RetroArch-Playlists-Generator 作者: Kierek 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        from playlist_creator import preferences_file_location, systems_list

        self.settings_file_location = preferences_file_location
        with open(self.settings_file_location) as data_file:
            self.preferences_data = json.load(data_file)

        builder = Gtk.Builder()
        builder.add_from_file("glade/app.glade")
        builder.connect_signals(self)

        self.notebook = builder.get_object("notebook")
        self.renderer_text = Gtk.CellRendererText()

        self.playlists_directory_chooser = builder.get_object("playlists_directory_chooser")
        self.cores_directory_chooser = builder.get_object("cores_directory_chooser")
        self.infos_directory_chooser = builder.get_object("infos_directory_chooser")

        self.playlists_location = self.preferences_data[0]['playlists_location']
        self.cores_location = self.preferences_data[0]['cores_location']
        self.infos_location = self.preferences_data[0]['infos_location']

        self.playlists_directory_chooser.set_current_folder(self.playlists_location)
        self.cores_directory_chooser.set_current_folder(self.cores_location)
        self.infos_directory_chooser.set_current_folder(self.infos_location)

        self.system_names = Gtk.ListStore(str)
        for system_name in systems_list:
            self.system_names.append([system_name])

        # get all cores and populate list
        self.__populate_cores_list__()

        if len(self.preferences_data) > 1:
            for system_from_prefs in self.preferences_data[1]:
                self.create_new_tab(system_from_prefs['system_name'], system_from_prefs['roms_dir'],
                                    system_from_prefs['core_path'], system_from_prefs['core_name'])

        window = builder.get_object("window")
        window.show_all()
        Gtk.main()
gui_resolver.py 文件源码 项目:RetroArch-Playlists-Generator 作者: Kierek 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __populate_cores_list__(self):
        self.cores_list = Gtk.ListStore(str)
        for core in sorted(os.listdir(self.cores_location)):
            self.cores_list.append([core])
SBrickInfoBox.py 文件源码 项目:sbrick-controller 作者: wintersandroid 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        Gtk.Frame.__init__(self)
        self.sbrick = None
        self.set_label("SBrick Information")

        self.store = Gtk.ListStore(str, str)
        self.iterSBrickID = self.store.append(["SBrick BlueGiga ID", "--"])
        self.iterHardwareVersion = self.store.append(["Hardware Version", "--"])
        self.iterSoftwareVersion = self.store.append(["Software Version", "--"])
        self.iterNeedAuthentication = self.store.append(["Need Authentication", "--"])
        self.iterIsAuthenticated = self.store.append(["Is Authenticated", "--"])
        self.iterAuthenticationTimeout = self.store.append(["Authentication Timeout", "--"])
        self.iterInputVoltage = self.store.append(["Input Voltage", "--"])
        self.iterTemperature = self.store.append(["Temperature", "--"])
        self.iterPowerCycles = self.store.append(["Power Cycles", "--"])
        self.iterWatchdogTimeout = self.store.append(["Watchdog Timeout", "--"])
        self.iterUpTime = self.store.append(["Up Time", "--"])
        self.iterThermalLimit = self.store.append(["Thermal Limit", "--"])

        self.listView = Gtk.TreeView(self.store)

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Item", renderer, text=0)
        self.listView.append_column(column)

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Value", renderer, text=1)
        self.listView.append_column(column)

        self.scrollTree = Gtk.ScrolledWindow()
        self.scrollTree.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.scrollTree.add_with_viewport(self.listView)
        self.scrollTree.set_min_content_height(100)

        self.add(self.scrollTree)
        self.set_sensitive(False)
alarmdialog.py 文件源码 项目:btcwidget 作者: rafalh 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _create_market_combo(self):
        store = Gtk.ListStore(str, str, str)
        for market_config in config['markets']:
            provider = btcwidget.exchanges.factory.get(market_config['exchange'])
            market_name = '{} - {}'.format(provider.get_name(), market_config['market'])
            store.append([market_name, market_config['exchange'], market_config['market']])
        combo = Gtk.ComboBox.new_with_model(store)
        renderer_text = Gtk.CellRendererText()
        combo.pack_start(renderer_text, True)
        combo.add_attribute(renderer_text, "text", 0)
        return combo, store
efibootmgr-gui.py 文件源码 项目:efibootmgr-gui 作者: Elinvention 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, window):
        self.window = window
        Gtk.ListStore.__init__(self, str, str, str, bool, bool)
        self.regex = re.compile("^Boot([0-9A-F]+)(\*)? (.+)\t(?:.+File\((.+)\))?.*$")
        self.refresh()
widgets.py 文件源码 项目:mcg 作者: coderkun 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def __init__(self, builder):
        GObject.GObject.__init__(self)
        self._services = Gtk.ListStore(str, str, int)
        self._profile = None

        # Widgets
        self._panel = builder.get_object('server-panel')
        self._toolbar = builder.get_object('server-toolbar')
        # Zeroconf
        self._zeroconf_list = builder.get_object('server-zeroconf-list')
        self._zeroconf_list.set_model(self._services)
        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Zeroconf", renderer, text=0)
        self._zeroconf_list.append_column(column)
        # Host
        self._host_entry = builder.get_object('server-host')
        # Port
        self._port_spinner = builder.get_object('server-port')
        # Passwort
        self._password_entry = builder.get_object('server-password')
        # Image directory
        self._image_dir_entry = builder.get_object('server-image-dir')

        # Zeroconf provider
        self._zeroconf_provider = ZeroconfProvider()
        self._zeroconf_provider.connect_signal(ZeroconfProvider.SIGNAL_SERVICE_NEW, self.on_new_service)
gu.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def sComboBox(exname, name, strings):
    liststore = Gtk.ListStore(str)
    for s in strings:
        liststore.append([s])
    g = Gtk.ComboBox.new_with_model_and_entry(liststore)
    g.set_entry_text_column(0)
    g.get_child().set_text(cfg.get_string("%s/%s" % (exname, name)))
    g.connect('changed', lambda w:
            cfg.set_string("%s/%s" % (exname, name),
                           w.get_child().get_text().decode("utf-8")))
    return g
IconWindow.py 文件源码 项目:bcloud 作者: wangYanJava 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent, app):
        super().__init__()
        self.parent = parent
        self.app = app

        # pixbuf, name, path, tooltip, size, humansize,
        # isdir, mtime, human mtime, type, pcs_file
        self.liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str,
                                       GObject.TYPE_INT64, str,
                                       GObject.TYPE_INT, GObject.TYPE_INT64,
                                       str, str, str)
        self.init_ui()


问题


面经


文章

微信
公众号

扫码关注公众号