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


Python Button.set_sensitive方法代码示例

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


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

示例1: __on_plugin_directories_button_click

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import set_sensitive [as 别名]
 def __on_plugin_directories_button_click(self, button):
     """Present a dialog to the user for selecting extra plugin directories
     and process the request."""
     
     dia = Dialog('Plugin Directories',
          None, DIALOG_MODAL,
          (STOCK_OK, RESPONSE_OK,
          STOCK_CANCEL, RESPONSE_CANCEL ) )
     dia.resize(500, 300)
     dia.vbox.set_spacing(8)
     
     # Setup the tree view of plugin directories.
     model = ListStore(str) # each row contains a single string
     tv = TreeView(model)
     cell = CellRendererText()
     column = TreeViewColumn('Directory', cell, text = 0)
     tv.append_column(column)
     dia.vbox.pack_start(tv)
     
     # Populate the tree view.
     plugin_directories = \
         get_plugins_directories_from_config(self.config, self.config_path)
     for plugin_directory in plugin_directories:
         row = (plugin_directory,)
         model.append(row)
     
     modify_box = HBox(spacing = 8)
     
     # Setup the remove directory button.
     remove_button = Button('Remove')
     remove_button.set_sensitive(False) # no directory selected initially
     remove_button.connect('clicked', self.__on_remove, tv)
     modify_box.pack_end(remove_button, expand = False)
     
     tv.connect('cursor-changed', self.__on_select, remove_button)
     
     # Setup the add directory button.
     add_button = Button('Add')
     add_button.connect('clicked', self.__on_add, tv)
     modify_box.pack_end(add_button, expand = False)
     
     dia.vbox.pack_start(modify_box, expand = False)
     
     # Setup the "already included directories" label.
     included_label = Label('Plugins in the PYTHONPATH are already ' +
                            'available to BoKeep.')
     # Use a horizontal box to left-justify the label.  For some reason,
     # the label's set_justification property doesn't work for me.
     label_box = HBox()
     label_box.pack_start(included_label, expand = False)
     dia.vbox.pack_start(label_box, expand = False)
     
     dia.show_all()
     dia_result = dia.run()
     
     if dia_result == RESPONSE_OK:            
         # Remove the old plugin directories from the program's path.
         plugin_directories = \
             get_plugins_directories_from_config(self.config,
                                                 self.config_path)
         for plugin_directory in plugin_directories:
             path.remove(plugin_directory)
         
         # Get the new plugin directories from the dialog.
         plugin_directories = []
         for row in model:
             plugin_directory = row[0]
             plugin_directories.append(plugin_directory)
         
         # Update the BoKeep PYTHONPATH so that new plugins can be loaded and
         # populate the list of possible new plugins.
         for plugin_directory in plugin_directories:
             path.append(plugin_directory)
         self.__populate_possible_plugins()
         
         # Save the new plugin directories in the configuration file.
         set_plugin_directories_in_config(self.config,
             self.config_path, plugin_directories)
     
     dia.destroy()
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:82,代码来源:bokeepdb.py


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