当前位置: 首页>>代码示例>>Python>>正文


Python gtk.ListStore类代码示例

本文整理汇总了Python中gtk.ListStore的典型用法代码示例。如果您正苦于以下问题:Python ListStore类的具体用法?Python ListStore怎么用?Python ListStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ListStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_gui

    def build_gui(self):
        """Called by __init__ to take care of the gtk work or putting the
        gui together.

        This consists of loading mainwindow from the glade file,
        setting the bokeep logo, and getting the cell renderers and
        empty models set up for the book and transaction type combo boxes.
        Ends with a a call to set_sensitivities_and_status to nicely
        grey things out until we have something for the shell to actually
        display.

        This is meant to be done without self.book or self.guistate being
        available yet. It shouldn't be called from anywhere other than
        __init__, and only once.
        """
        
        glade_file = get_main_window_glade_file()
        load_glade_file_get_widgets_and_connect_signals(
            glade_file, "mainwindow", self, self )
        self.mainwindow.set_icon_from_file(get_bo_keep_logo())

        self.books_combobox_model = ListStore(str, str, object)
        self.books_combobox.set_model(self.books_combobox_model)
        cell = CellRendererText()
        self.books_combobox.pack_start(cell, True)
        self.books_combobox.add_attribute(cell, 'text', 0)
        self.trans_type_model = ListStore(str, int, object)
        self.set_sensitivities_and_status()
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:28,代码来源:mainwindow.py

示例2: warning_dialog

class warning_dialog(Dialog):
    def __init__(self, parent, pacs, icon):

        Dialog.__init__(
            self,
            _("Warning!"),
            parent,
            DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
            (STOCK_YES, RESPONSE_YES, STOCK_NO, RESPONSE_REJECT),
        )

        self.set_icon(pixbuf_new_from_file(icon))
        self._setup_tree(pacs)
        self._setup_layout()

    def _setup_layout(self):

        self.set_default_size(-1, 250)

        label = Label(
            _(
                "This packages requires one of the packages you've selected for removal.\nDo you want to remove them all?"
            )
        )
        label.show()

        scr = ScrolledWindow()
        scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        scr.add(self.tree)

        self.vbox.pack_start(label, False, False, 0)
        self.vbox.pack_start(scr, True, True, 0)
        self.vbox.show_all()
        return

    def _setup_tree(self, pacs):
        self.tree = TreeView()
        self.model = ListStore(str, str, str)

        self.tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(), stock_id=0)
        self.tree.insert_column_with_attributes(-1, "", CellRendererText(), text=1)
        self.tree.insert_column_with_attributes(-1, "", CellRendererText(), text=2)

        for pac in pacs:
            if pac.isold:
                image = "yellow"
            elif pac.installed:
                image = "green"
            else:
                image = "red"

            self.model.append([image, pac.name, pac.inst_ver])
            continue

        self.tree.set_model(self.model)
        self.tree.show_all()
        return
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:57,代码来源:dialogs.py

示例3: upgrade_confirm_dialog

class upgrade_confirm_dialog(Dialog):

    def __init__(self, parent, to_upgrade, icon):

        Dialog.__init__(self, _("Confirm Upgrade"), parent,
                        DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
                        (STOCK_OK, RESPONSE_ACCEPT,
                         STOCK_CANCEL, RESPONSE_REJECT))

        self.set_icon(pixbuf_new_from_file(icon))
        self._setup_tree(to_upgrade)
        self._setup_layout()
        
    def _setup_tree(self, pacs):
        self.model = ListStore(str, str, str)

        for pac in pacs:
            self.model.append(["yellow", pac.name, pac.version])
            continue

        self.tree = TreeView()
        self.tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(),
                                                stock_id = 0)
        self.tree.insert_column_with_attributes(-1, "Package",
                                                CellRendererText(), text = 1)
        self.tree.insert_column_with_attributes(-1, "Version",
                                                CellRendererText(), text = 2)

        self.tree.set_model(self.model)
        self.tree.show()

    def _setup_layout(self):

        self.label = Label(_("Are you sure yo want to upgrade those packages?\n"))
        self.label.show()

        self.set_default_size (300, 300)

        scr = ScrolledWindow()
        scr.set_policy("automatic", "automatic")
        scr.add(self.tree)
        scr.show()
        
        self.vbox.pack_start(self.label, False, False, 0)
        self.vbox.pack_start(scr, True, True, 0)

    def run(self):
        retcode = Dialog.run(self)
        self.destroy()

        if retcode == RESPONSE_ACCEPT:
            return True
        else:
            return False
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:54,代码来源:dialogs.py

示例4: __init__

    def __init__(self, pacs):

        ListStore.__init__(self, str, str, str, str, str, int)
        
        for pac_tuple in enumerate( pacs ):
            if not pac_tuple[1].installed:
                continue
            
            position = pac_tuple[0]
            if pac_tuple[1].isold:
                image = "yellow"
            else:
                image = "green"
                
            self.append([image, None, pac_tuple[1].name, pac_tuple[1].inst_ver, pac_tuple[1].version, position])
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:15,代码来源:models.py

示例5: __init__

    def __init__(self, pacs):

        ListStore.__init__(self, str, str, str, str, str)

        for pac in pacs:
            if not pac.installed:
                continue

            if pac.isold:
                image = "yellow"
            else:
                image = "green"
                
            self.append([image, None, pac.name, pac.inst_ver, pac.version])
            continue
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:15,代码来源:models.py

示例6: __init__

    def __init__(self, trans, transid, plugin, gui_parent,
                 change_register_function):
        self.fee_trans = trans
        self.transid = transid
        self.memberfee_plugin = plugin
        self.change_register_function = change_register_function

        load_glade_file_get_widgets_and_connect_signals(
            get_memberfee_glade_file(),
            'window1', self, self)

        self.vbox1.reparent(gui_parent)
        self.window1.hide()

        self.fee_spread_liststore = ListStore(str, str)
        self.fee_spread_list.set_model(self.fee_spread_liststore)
        column_one = TreeViewColumn('Date')
        column_two = TreeViewColumn('Amount')
        self.fee_spread_list.append_column(column_one)
        self.fee_spread_list.append_column(column_two)
        for i, column in enumerate((column_one, column_two)):
            cell = CellRendererText()
            column.pack_start(cell, False)
            column.add_attribute(cell, 'text', i)
        self.populate_fee_spread_liststore()
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:25,代码来源:plugin.py

示例7: _setup_install_tree

    def _setup_install_tree(self, queue):
        
        self.install_tree = TreeView()
        self.install_model = ListStore(str, str, str)

        self.install_tree.insert_column_with_attributes(-1, "",
                                                        CellRendererPixbuf(),
                                                        stock_id=0)
        self.install_tree.insert_column_with_attributes(-1, _("Package"),
                                                        CellRendererText(),
                                                        text=1)
        self.install_tree.insert_column_with_attributes(-1, _("Version"),
                                                        CellRendererText(),
                                                        text=2)

        for pac in queue:
            if pac.isold:
                image = "yellow"
            elif pac.installed:
                image = "green"
            else:
                image = "red"

            self.install_model.append([image, pac.name, pac.version])
            continue
        self.install_tree.set_model(self.install_model)
        return
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:27,代码来源:dialogs.py

示例8: extended_init

    def extended_init(self):
        self.trustor_list = ListStore( str )
        self.trustor_combo.set_model(self.trustor_list)
        index = 0
        use_index = -1
        for trustor_name in self.trustors:
            self.trustor_list.append([trustor_name])
            if not(self.trans_trustor == None) and self.trans_trustor.name == trustor_name:
                use_index = index
            index += 1
 
        if use_index > -1:
            self.trustor_combo.set_active(use_index)
            self.amount_entry.set_text(str(self.trust_trans.get_displayable_amount()))
            self.description_textview.get_buffer().set_text(str(self.trust_trans.get_memo()))
        else:
            self.trustor_combo.set_active(0)

        trans_date = self.trust_trans.trans_date
        self.entry_date_label.set_text(
                "%s-%s-%s" %
                (trans_date.year, trans_date.month, trans_date.day) )


        if not self.editable or self.trust_trans.get_trustor() == None :
            self.amount_entry.set_sensitive(False)
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:26,代码来源:trustor_entry.py

示例9: _setup_tree

    def _setup_tree(self, pacs):
        self.tree = TreeView()
        self.model = ListStore(str, str, str)

        self.tree.insert_column_with_attributes(-1, "",
                                                CellRendererPixbuf(),
                                                stock_id=0)
        self.tree.insert_column_with_attributes(-1, "",
                                                CellRendererText(),
                                                text=1)
        self.tree.insert_column_with_attributes(-1, "",
                                                CellRendererText(),
                                                text=2)

        for pac in pacs:
            if pac.isold:
                image = "yellow"
            elif pac.installed:
                image = "green"
            else:
                image = "red"

            self.model.append([image, pac.name, pac.inst_ver])
            continue

        self.tree.set_model(self.model)
        self.tree.show_all()
        return
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:28,代码来源:dialogs.py

示例10: MemberFeeCollectionEditor

class MemberFeeCollectionEditor(object):
    def __init__(self, trans, transid, plugin, gui_parent,
                 change_register_function):
        self.fee_trans = trans
        self.transid = transid
        self.memberfee_plugin = plugin
        self.change_register_function = change_register_function

        load_glade_file_get_widgets_and_connect_signals(
            get_memberfee_glade_file(),
            'window1', self, self)

        self.vbox1.reparent(gui_parent)
        self.window1.hide()

        self.fee_spread_liststore = ListStore(str, str)
        self.fee_spread_list.set_model(self.fee_spread_liststore)
        column_one = TreeViewColumn('Date')
        column_two = TreeViewColumn('Amount')
        self.fee_spread_list.append_column(column_one)
        self.fee_spread_list.append_column(column_two)
        for i, column in enumerate((column_one, column_two)):
            cell = CellRendererText()
            column.pack_start(cell, False)
            column.add_attribute(cell, 'text', i)
        self.populate_fee_spread_liststore()

        
    def populate_fee_spread_liststore(self):
        self.fee_spread_liststore.clear()
        for month in gen_n_months_starting_from(first_of(date.today()), 4):
            self.fee_spread_liststore.append((month, '10'))

    def detach(self):
        self.vbox1.reparent(self.window1)

    def day_changed(self, *args):
        print('day_changed')

    def amount_collected_changed(self, *args):
        print('amount_collected_changed')

    def member_changed(self, *args):
        print('member_changed')
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:44,代码来源:plugin.py

示例11: HttpHandler

class HttpHandler(object):
    """Has callbacks that are invoked by the event system.

    It only accepts packets if:
        * They are HTTP requests
        * send or received by the IP given. If none is given, every
          IP is accepted.
    
    Subclass and overwrite handle for great good."""
    def __init__(self, ip = None):
        self.ip = ip
        self.gtk_list_store = ListStore(str, str)

    def accept(self, pkg):
        logger.debug("Accepting? %s", pkg.summary())
        if not pkg.haslayer(TCP): return False
        tcp_pkg = pkg[TCP]
        if not (tcp_pkg.dport == 80 or tcp_pkg.sport == 80): return False
        if isinstance(tcp_pkg.payload, NoPayload): return False
        if not GET.match(str(tcp_pkg.payload)): return False
        if self.ip is not None: 
            return pkg[IP].src == self.ip or pkg[IP].dst == self.ip
        else:
            return True
    def handle(self, pkg):
        self.print(pkg)

    def print(self, pkg):
        logger.debug("got a package %s to print", pkg.summary())
        time = datetime.fromtimestamp(pkg.time)
        logger.debug("initially at time={}".format(time))
        tcp_pkg = pkg[TCP]
        server_name = reverse_dns(pkg[IP].dst)
        match = GET.match(str(tcp_pkg.payload))
        try:
            entry = "http://{}{}".format(str(server_name.result(5.0)), match.group(1))
        except TimeoutError:
            entry = "http://{}{}".format(str(pkg[IP].dst), match.group(1))
        logger.info(entry)
        self.gtk_list_store.append([str(time), entry])
开发者ID:panmari,项目名称:moco-project,代码行数:40,代码来源:reader.py

示例12: create_prop_store

 def create_prop_store(self, extra_props=[]):
     assert(self.component is not None)
     from gtk import ListStore
     store = ListStore(object, str, object)
     # use private properties so we connect to the actual object stores and not the inherited ones
     for atom in self.component._layer_atoms:
         store.append([atom, "pn", lambda o: o.name])
     for atom in self.component._interlayer_atoms:
         store.append([atom, "pn", lambda o: o.name])
     for prop in extra_props:
         store.append(prop)
     return store
开发者ID:claudioquaglia,项目名称:PyXRD,代码行数:12,代码来源:unit_cell_prop.py

示例13: _setup_tree

    def _setup_tree(self, pacs):
        self.model = ListStore(str, str, str)

        for pac in pacs:
            self.model.append(["yellow", pac.name, pac.version])
            continue

        self.tree = TreeView()
        self.tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(), stock_id=0)
        self.tree.insert_column_with_attributes(-1, "Package", CellRendererText(), text=1)
        self.tree.insert_column_with_attributes(-1, "Version", CellRendererText(), text=2)

        self.tree.set_model(self.model)
        self.tree.show()
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:14,代码来源:dialogs.py

示例14: refresh_trustor_list

    def refresh_trustor_list(self):
        
        self.reset_view()

        self.trustor_list = ListStore( str, str )
        self.trustor_view.set_model(self.trustor_list)


        for i, title in enumerate(('Trustor', 'Balance')):
            self.trustor_view.append_column(
                TreeViewColumn(title,CellRendererText(), text=i ) )

        for trustor in self.trustors:
            self.trustor_list.append([trustor, str(self.trustors[trustor].get_balance())])
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:14,代码来源:trustor_management.py

示例15: extended_init

    def extended_init(self):
        self.widgets['name_entry'].set_text(self.trustor.name)
        self.widgets['name_entry'].connect('changed', self.on_name_entry_changed)
        
        self.widgets['dyn_balance'].set_text(str(self.trustor.get_balance()))
        
        self.transactions_view = self.widgets['transactions_view']

        self.transactions_list = ListStore( str, str, str )
        self.transactions_view.set_model(self.transactions_list)


        for i, title in enumerate(('Date', 'Type', 'Balance')):
            self.transactions_view.append_column(
                TreeViewColumn(title,CellRendererText(), text=i ) )

        for transaction in self.trustor.transactions:
            self.transactions_list.append([transaction.trans_date.strftime("%B %d, %Y, %H:%M"), self.get_tran_type(transaction), str(transaction.get_transfer_amount())])
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:18,代码来源:trustor_transactions.py


注:本文中的gtk.ListStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。