本文整理汇总了Python中higwidgets.higboxes.HIGVBox.pack_start方法的典型用法代码示例。如果您正苦于以下问题:Python HIGVBox.pack_start方法的具体用法?Python HIGVBox.pack_start怎么用?Python HIGVBox.pack_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higboxes.HIGVBox
的用法示例。
在下文中一共展示了HIGVBox.pack_start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TabBox
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class TabBox(gtk.ScrolledWindow):
"""
it's a page of TabsWidget
"""
def __init__(self, name):
gtk.ScrolledWindow.__init__(self)
self.frame = TabFrame(name)
self.frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
self.__main_box = HIGVBox()
self.frame.add(self.__main_box)
self._create_widgets()
self.viewport = gtk.Viewport()
self.viewport.add(self.frame)
self.add(self.viewport)
self.viewport.set_shadow_type(gtk.SHADOW_NONE)
self.props.shadow_type = gtk.SHADOW_NONE
self.__main_box.set_border_width(6)
self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
def _create_widgets(self):
""" Overwrite me, it's subclass """
# Box Interface
def pack_start(self, *args):
self.__main_box.pack_start(*args)
def pack_end(self, *args):
self.__main_box.pack_end(*args)
def destroy(self):
pass
示例2: create_widgets
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def create_widgets(self):
vboxmain = gtk.VBox()
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.store = gtk.ListStore(str)
self.update_model()
self.treeView = gtk.TreeView(self.store)
#treeView.connect("row-activated", self.on_activated)
#treeView.set_rules_hint(True)
self.create_columns(self.treeView)
sw.add(self.treeView)
# buttons
vbox = HIGVBox()
btn = HIGButton(_("Edit..."), gtk.STOCK_EDIT)
vbox.pack_start(btn, False, False)
btn.connect("clicked", self._edit_template)
btn = HIGButton(_("Remove"), gtk.STOCK_REMOVE)
vbox.pack_start(btn, False, False)
btn.connect("clicked", self._remove_template)
hbox = HIGHBox()
hbox.pack_start(sw, True, True)
hbox.pack_start(vbox, False, False)
vboxmain.pack_start(hbox, True, True, 0)
self.add(vboxmain)
self.show_all()
示例3: __create_tab
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def __create_tab(self, tab_name, section_name, tab):
log.debug(">>> Tab name: %s" % tab_name)
log.debug(">>>Creating profile editor section: %s" % section_name)
vbox = HIGVBox()
table = HIGTable()
section = HIGSectionLabel(section_name)
vbox._pack_noexpand_nofill(section)
vbox._pack_noexpand_nofill(HIGSpacer(table))
vbox.set_border_width(6)
tab.fill_table(table, True)
self.scrollwindow = HIGScrolledWindow()
self.scrollwindow.set_size_request(600,300)
vp = gtk.Viewport()
vp.add(vbox)
vp.set_shadow_type(gtk.SHADOW_NONE)
self.scrollwindow.add(vp)
vbox_tmp = HIGVBox()
vbox_tmp.set_border_width(6)
vbox_tmp.set_spacing(12)
vbox_tmp.pack_start(self.scrollwindow)
self.notebook.append_page(vbox_tmp, gtk.Label(tab_name))
示例4: __init__
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def __init__(self, section_name, profile, listoptions, notebook_parent, new=False):
"""
A Box Editable contains a options of each tab
@param section_name: section name <tab>
@type section_name: str
@param profile: A class that view and modify xml file
@type profile: ProfileCore
@param listoptions: The List of Options to update XML (I guess to confirm)
@type listoptions: ListOptions
@param notebook_parent: Notebook
@type notebook_parent: Notebook or Subclass
@param new: It's a new tab or not
@type new: bool
"""
HIGVBox.__init__(self)
self._coords = {}
self._parent = notebook_parent
self._last = None
#Profile Core do a manage at profile_editor.xml file
self._profilecore = None
self._profile = profile
self._listoptions = listoptions
self._table = HIGTable()
self._section_name = section_name
if not new :
self._options = self._profile.get_section(section_name)
self._table.set_border_width(3)
c = self.get_colormap()
color = c.alloc_color(0,0,0)
self._table.modify_fg(gtk.STATE_NORMAL,color )
#self._fill_table()
box_tmp = HIGVBox()
box_tmp.pack_start(self._table, False, False)
self._sw = HIGScrolledWindow()
#self._sw.set_size_request(400,200)
vp = gtk.Viewport()
vp.add(box_tmp)
vp.set_shadow_type(gtk.SHADOW_NONE)
self._sw.add(vp)
self.pack_start(self._sw, True, True)
self._old_selected = None
self._x = 0
self._y = 0
self.connect('button-press-event', self._bp)
示例5: SuperPeerListWindow
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class SuperPeerListWindow(HIGWindow):
def __init__(self):
HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
self.set_title(_('Super Peers List'))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.__create_widgets()
self.__pack_widgets()
self.__load_super_peers()
def __create_widgets(self):
self.main_vbox = HIGVBox()
self.add(self.main_vbox)
self.btn_box = gtk.HButtonBox()
self.ok_button = gtk.Button(stock=gtk.STOCK_SAVE)
self.ok_button.connect('clicked', lambda x: self.__save_super_peers())
self.cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
self.cancel_button.connect('clicked', lambda x: self.destroy())
self.SuperPeersBox_vbox = HIGVBox()
self.SuperPeersBox_hbox1 = HIGHBox()
self.SuperPeersBox_hbox2 = HIGHBox()
self.SuperPeersBox_subbox = SuperPeersBox()
self.SuperPeersBox_hbox1.add(self.SuperPeersBox_subbox)
def __pack_widgets(self):
self.main_vbox._pack_expand_fill(self.SuperPeersBox_hbox1)
self.btn_box.set_layout(gtk.BUTTONBOX_END)
self.btn_box.set_spacing(3)
self.btn_box.pack_start(self.ok_button)
self.btn_box.pack_start(self.cancel_button)
self.main_vbox.pack_start(self.btn_box)
self.main_vbox.set_border_width(8)
self.SuperPeersBox_vbox.pack_start(self.SuperPeersBox_hbox1, True, True, 5)
self.SuperPeersBox_vbox.pack_start(self.SuperPeersBox_hbox2, True, True, 5)
def __save_super_peers(self):
self.destroy()
def __load_super_peers(self):
text = ""
for peer_entry in theApp.peer_manager.super_peers.values():
text = text + "%s:%d\n" % (peer_entry.IP, peer_entry.Port)
self.SuperPeersBox_subbox.textbuffer.set_text(text)
示例6: create_edit_mode
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def create_edit_mode(self):
"""
Create a treeview that contains a three edit modes
returns vbox contains a treeview
@return: returns the treeview with list of edit modes
@rtype: vbox
"""
model = gtk.TreeStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING)
self.edit_mode_tv = gtk.TreeView(model)
self.edit_mode_tv.set_headers_visible(False)
renderer = gtk.CellRendererText()
cell_renderer_pix = gtk.CellRendererPixbuf()
column = gtk.TreeViewColumn()
column.set_title(_("Name"))
column.pack_start(cell_renderer_pix, False)
column.add_attribute(cell_renderer_pix, "pixbuf", 0)
column.pack_start(renderer, True)
column.add_attribute(renderer, "text", 1)
self.edit_mode_tv.append_column(column)
myiter = model.insert_before(None, None)
icon = gtk.Image()
icon = icon.render_icon("gtk-edit", gtk.ICON_SIZE_MENU)
model.set_value(myiter, 0, icon)
model.set_value(myiter, 1, "Profile")
myiter = model.insert_before(None, None)
icon = gtk.Image()
icon = icon.render_icon("gtk-convert", gtk.ICON_SIZE_MENU)
model.set_value(myiter, 0, icon)
model.set_value(myiter, 1, "Wizard")
myiter = model.insert_before(None, None)
icon = gtk.Image()
icon = icon.render_icon(gtk.STOCK_DND_MULTIPLE, gtk.ICON_SIZE_MENU)
model.set_value(myiter, 0, icon)
model.set_value(myiter, 1, "Options")
selection = self.edit_mode_tv.get_selection()
selection.select_iter(myiter)
self.edit_mode_tv.connect("cursor-changed", self.change_edit_mode)
vbox = HIGVBox()
vbox.pack_start(self.edit_mode_tv, False, False)
return vbox
示例7: ScriptManagerProgressWindow
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class ScriptManagerProgressWindow(HIGWindow):
def __init__(self, parent):
HIGWindow.__init__(self)
self.set_title(_("Script Manager Progress"))
self.set_position(gtk.WIN_POS_CENTER)
self.set_size_request(300, 200)
self.vbox = HIGVBox()
self.label = gtk.Label()
self.vbox.pack_start(self.label)
self.progress_all = HIGLabeledProgressBar(_("Overall progress"))
self.vbox.pack_start(self.progress_all)
self.progress_current = HIGLabeledProgressBar(_("Current source"))
self.vbox.pack_start(self.progress_current)
self.btn_cancel = HIGButton(stock=gtk.STOCK_CANCEL)
self.btn_cancel.connect("clicked", self._cancel_cb)
self.vbox.pack_start(self.btn_cancel)
self.add(self.vbox)
self.show_all()
self.timeout_id = gobject.timeout_add(100, self.callback)
self.status = (None, None, None)
import thread
self.lock = thread.allocate_lock()
reload_thread(parent.base, self, self.lock)
#thread.start_new_thread(reload_thread, (parent.base, self, self.lock))
#self.thread = ScriptManagerReloadThread(parent.base)
#self.thread.start()
def _cancel_cb(self, widget):
if self.timeout_id:
gobject.source_remove(self.timeout_id)
self.lock.acquire()
self.destroy()
def callback(self):
src, all, current = self.status
print "cb:", self.status
if src:
self.label.set_text(src.path)
if all:
if all[0] == all[1]:
gobject.source_remove(self.timeout_id)
self.timeout_id = None
self.progress_all.progress_bar.set_fraction(float(all[0])/all[1])
self.progress_all.label.set_text("%d/%d" % all)
else:
self.progress_all.progress_bar.set_fraction(0)
self.progress_all.label.set_text("")
if current:
self.progress_current.progress_bar.set_fraction(float(current[0])/current[1])
self.progress_current.label.set_text("%d/%d" % current)
else:
self.progress_current.progress_bar.set_fraction(0)
self.progress_current.label.set_text("")
示例8: quit
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def quit(self, widget=None, extra=None):
if self.deleted:
dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
alert = HIGEntryLabel('<b>'+_("Deleting Profile")+'</b>')
text = HIGEntryLabel(_('Your profile is going to be deleted! Click\
Ok to continue, or Cancel to go back to Profile Editor.'))
hbox = HIGHBox()
hbox.set_border_width(5)
hbox.set_spacing(12)
vbox = HIGVBox()
vbox.set_border_width(5)
vbox.set_spacing(12)
image = gtk.Image()
image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
vbox.pack_start(alert)
vbox.pack_start(text)
hbox.pack_start(image)
hbox.pack_start(vbox)
dialog.vbox.pack_start(hbox)
dialog.vbox.show_all()
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return None
self.destroy()
if self.scan_notebook != None:
for i in xrange(self.scan_notebook.get_n_pages()):
page = self.scan_notebook.get_nth_page(i)
page.toolbar.profile_entry.update()
示例9: on_delete
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def on_delete(self, widget=None):
if not self.profile_name:
return self.on_cancel()
dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
alert = HIGEntryLabel('<b>'+_("Deleting Profile")+'</b>')
text = HIGEntryLabel(_('Your profile is going to be deleted! Click \
Ok to continue, or Cancel to go back to Profile Editor.'))
hbox = HIGHBox()
hbox.set_border_width(5)
hbox.set_spacing(12)
vbox = HIGVBox()
vbox.set_border_width(5)
vbox.set_spacing(12)
image = gtk.Image()
image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
vbox.pack_start(alert)
vbox.pack_start(text)
hbox.pack_start(image)
hbox.pack_start(vbox)
dialog.vbox.pack_start(hbox)
dialog.vbox.show_all()
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return None
self.deleted = True
self.profile.remove_profile(self.profile_name)
self.on_cancel()
示例10: __do_layout
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def __do_layout(self):
"""
Layout window widgets.
"""
main_vbox = HIGVBox()
btns_box = HIGHBox()
main_vbox.pack_start(self.logo_img)
main_vbox.pack_start(self.lbl_program_version)
main_vbox.pack_start(self.lbl_program_description)
btns_box.pack_end(self.btn_close)
main_vbox._pack_noexpand_nofill(btns_box)
self.btn_close.grab_focus()
self.add(main_vbox)
示例11: ListManager
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class ListManager(gtk.Dialog):
'''
ListManager - manage the OptionList
Tricks:
- To works with the Command Manager it save at __init__ the list
of options. After that. Add to CommandManager when clicked 'Ok Button'
with the new and old list.
'''
def __init__(self, name, section, profilecore, widget, title):
gtk.Dialog.__init__(self,title)
self.set_size_request(450, 300)
self._name = name
self._section = section
self._profilecore = profilecore
self._widget = widget
self._list = self._profilecore.get_list_opt(self._section, self._name)
self._new_list = self._profilecore.get_list_opt(self._section,
self._name)
self._create_widgets()
self.show()
self._load_option_list()
self._create_action_area()
def _create_widgets(self):
self._optionlist = OptionList()
label = gtk.Label('Items at the %s ' % self._name)
self._box = gtk.HPaned()
ol = self._optionlist
ol.reload()
self.vbox.pack_start(label, False, False, 0)
self._box.add(ol)
self.vbox.pack_start(self._box)
self._box.show_all()
self._move_box = HIGVBox()
self._add_bt = HIGButton(stock='gtk-add')
self._add_bt.connect('clicked', self._on_add_press)
self._remove_bt = HIGButton(stock='gtk-remove')
self._remove_bt.connect('clicked', self._on_remove_press)
#XXX - moves don't work yet: lack the connect
self._move_up_bt = HIGButton(stock='gtk-go-up')
self._move_down_bt = HIGButton(stock='gtk-go-down')
self._move_box.pack_start(self._add_bt, False, False)
self._move_box.pack_start(self._remove_bt, False, False)
self._move_box.pack_start(self._move_up_bt, False, False)
self._move_box.pack_start(self._move_down_bt, False, False)
self._create_option_tv()
self._box.set_position(200)
self._box_other = gtk.HPaned()
self._box.add(self._box_other)
self._box_other.add(self._move_box)
self._box_other.add(self._sw)
self._move_box.show_all()
self.vbox.show_all()
label.show()
def _create_option_tv(self):
self._sw = HIGScrolledWindow()
self._model = gtk.TreeStore(gobject.TYPE_STRING)
self._tv = gtk.TreeView(self._model)
column = gtk.TreeViewColumn()
column.set_title('Name')
render = gtk.CellRendererText()
column.pack_start(render, expand=True)
column.add_attribute(render, 'text', 0)
self._tv.append_column(column)
self._sw.add(self._tv)
self._sw.show_all()
def _load_option_list(self):
list = self._list
for i in list :
iter = self._model.insert_before(None, None)
self._model.set_value(iter, 0, i)
def _create_action_area(self):
self._button_ok = HIGButton(stock='gtk-ok')
self._button_cancel = HIGButton(stock='gtk-cancel')
self._button_cancel.connect('clicked', self._on_cancel_press)
self._button_ok.connect('clicked', self._on_ok_press)
self.action_area.pack_start(self._button_cancel)
self.action_area.pack_start(self._button_ok)
self.action_area.show_all()
def _on_add_press(self, widget):
log.debug('<<< Add Option to OptionList')
option_selected = self._optionlist.get_selected()
iter = self._model.insert_before(None, None)
self._model.set_value(iter, 0, option_selected)
self._new_list.append(option_selected)
def get_selected(self):
"""
Returns the string with name of selected option
"""
try:
treeselection = self._tv.get_selection()
(model,iter) = treeselection.get_selected()
#.........这里部分代码省略.........
示例12: Proprieties
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class Proprieties(HIGScrolledWindow):
'''
This box should be configurable
if widget is of a type all configuration should be change to this type
#tricks: option_list have a icon to fill with options
and option_check have a list of options in combo to change
'''
def __init__(self):
HIGScrolledWindow.__init__(self)
self._boxeditable = None
vp = gtk.Viewport()
self._create_widgets()
vp.add(self._box)
vp.set_shadow_type(gtk.SHADOW_NONE)
self.add(vp)
self._profilecore = None
self._selected = None
def set_profilecore(self, profilecore):
self._profilecore = profilecore
def _create_widgets(self):
'''
Create the main entrys of the option
'''
self._box = HIGVBox()
self._table = HIGTable()
#Name
self._label_name = HIGEntryLabel(_('Name'))
self._entry_name = HIGTextEntry()
self._entry_name.connect('activate', self._update_label)
#Type
self._label_type = HIGEntryLabel(_('Type'))
self._combo_type = gtk.combo_box_new_text()
self._combo_type.append_text('')
self._combo_type.append_text('Option List')
self._combo_type.append_text('Option Check')
self._combo_type.set_active(0)
self._combo_type.connect('changed', self.change_combo)
self._label_opt = HIGEntryLabel(_('Option'))
self._entry_opt = HIGTextEntry()
self._entry_opt.set_sensitive(False)
#For option list open a dialog to add/remove options
self._button_list = HIGButton('Edit Option List')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'combo.png')
img.set_from_file(img_dir)
self._button_list.set_image(img)
self._button_list.connect('button-press-event', self._button_list_clicked)
self._table.attach(self._label_name, 0,1,0, 1)
self._table.attach(self._entry_name, 1,2,0,1)
self._table.attach(self._label_type, 0,1,1,2)
self._table.attach(self._combo_type, 1,2,1, 2)
self._table.attach(self._button_list, 0,2, 3,4)
self._table.attach(self._label_opt, 0,1, 4,5)
self._table.attach(self._entry_opt, 1,2,4,5)
self._box.pack_start(self._table, False, False)
def _button_list_clicked(self, widget, event):
section_name = self._boxeditable.get_name()
lm = ListManager(self._entry_name.get_text(),section_name,
self._profilecore, self._selected, _('List of items'))
def _update_label(self, widget):
#XXX Replace by Command
log.debug("Update Label")
selected = self._selected
cmd = CommandChangeLabel(selected, self._entry_name.get_text(),
self._profilecore,self._boxeditable, True)
command_manager.add_command(cmd)
def change_combo(self,combo):
model = combo.get_model()
index = combo.get_active()
if index:
if model[index][0]=='Option List':
log.debug('Show Button List ')
self._button_list.show()
else:
log.debug('Hide Button List ')
self._button_list.hide()
return
#.........这里部分代码省略.........
示例13: InterfaceEditor
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
#.........这里部分代码省略.........
# Menubar
self.__create_menubar()
# Toolbar
self.__create_toolbar()
self.display_frame = HIGFrame()
self.display_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
self.display_frame.set_border_width(6)
self.hbox_edit = gtk.HBox()
self.hspacer = gtk.HPaned()
self.hspacer.set_border_width(0)
self.vbox_right = HIGVBox()
self.vbox_left = HIGVBox()
self.edit_mode_exp = gtk.Expander(_("Edit Modes"))
self.edit_mode_box = self.create_edit_mode()
self.notebook.set_scrollable(True)
self.notebook.append_page(self.list_options_box, HIGEntryLabel(_("Option List")))
self.list_options_box.reload()
self.__create_status_bar()
def __option_display(self):
self.display_frame.set_label("Options")
self.opt_display = OptionDisplayMainFrame()
self.opt_display.set_options_list(self.list_options_box)
self.list_options_box.set_option_display(self.opt_display)
self.display_frame.add_with_properties(self.opt_display)
self.vbox_left.pack_start(self.display_frame, False, False)
def __pack_widgets(self):
"""
Packing widgets of mainly windows
"""
self.add(self.main_vbox)
# Pack widgets to main_box
self.main_vbox.pack_start(self.hbox_edit, True, True)
# Paned
self.hbox_edit.pack_start(self.hspacer)
separator = gtk.VSeparator()
self.hspacer.pack1(self.vbox_left, False, False)
self.hspacer.set_position(580)
self.hspacer.pack2(self.vbox_right, False, True)
# Edit Mode
self.edit_mode_exp.add(self.edit_mode_box)
self.edit_mode_exp.set_expanded(True)
# Frame right
self.vbox_right.pack_start(self.edit_mode_exp, False, False)
self.vbox_right.pack_end(self.notebook, True, True)
# Status bar
self.main_vbox.pack_start(self.statusbar, False, False)
def create_edit_mode(self):
"""
示例14: SearchWindow
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class SearchWindow(HIGWindow, object):
"""Search Window. Shows informations about the search while it's running
"""
def __init__(self):
HIGWindow.__init__(self)
self.__create_widgets()
self.__pack_widgets()
self.__set_widgets()
def __create_widgets(self):
self.vbox = HIGVBox()
self.cancel_button = HIGButton(stock=gtk.STOCK_CANCEL)
self.button_box = gtk.HButtonBox()
self.search_file_label = HIGEntryLabel()
self.progress = gtk.ProgressBar()
def __pack_widgets(self):
self.add(self.vbox)
self.vbox.pack_start(self.search_file_label)
self.vbox.pack_start(self.progress)
self.vbox.pack_start(self.button_box)
self.button_box.pack_start(self.cancel_button)
def __set_widgets(self):
self.button_box.set_layout(gtk.BUTTONBOX_END)
self.set_title('Searching...')
self.set_size_request(350, -1)
self.set_position(gtk.WIN_POS_CENTER)
def set_filename(self, filename):
self.__filename = filename
self.search_file_label.set_text(_("File: %s") % filename)
def get_filename(self):
return self.__filename
def set_path(self, path):
self.__path = path
self.forward_progress_status()
self.progress.set_text(_("Searching inside '%s'") % path)
def get_path(self):
return self.__path
def set_fraction(self, fraction):
self.__fraction = fraction
def get_fraction(self):
return self.__fraction
def forward_progress_status(self):
try:
self.fraction
except:
self.fraction = 0.2
self.progress.set_fraction(self.fraction + self.progress.get_fraction())
filename = property(get_filename,
set_filename,
doc=_("File's name being searched"))
path = property(get_path,
set_path,
doc=_("Path being scanned"))
fraction = property(get_fraction,
set_fraction,
doc=_("Fraction of the progress bar"))
示例15: PreferenceWindow
# 需要导入模块: from higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class PreferenceWindow(HIGWindow):
"""
User Preference
"""
def __init__(self):
HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
self.set_title(_('OpenMonitor Preferences'))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.__create_widgets()
self.__pack_widgets()
self.load_preference()
def __create_widgets(self):
# Main widgets
self.hpaned = gtk.HPaned()
self.add(self.hpaned)
self.vbox = HIGVBox()
self.btn_box = gtk.HButtonBox()
self.btn_box1 = gtk.HButtonBox()
self.btn_box2 = gtk.HButtonBox()
self.ok_button = gtk.Button(stock=gtk.STOCK_OK)
self.ok_button.connect('clicked', lambda x: self.clicked_ok())
self.help_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("help"))
self.help_button.connect('clicked', lambda x: self.help_direct())
#self.apply_button = gtk.Button(stock=gtk.STOCK_APPLY)
#self.apply_button.connect('clicked', lambda x: self.save_preference())
self.cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
self.cancel_button.connect('clicked', lambda x: self.destroy())
# notebook
self.notebook = gtk.Notebook()
# General Preference page
self.general_page = GeneralPage()
self.notebook.append_page(self.general_page, gtk.Label(_("General")))
# Peer Info Page
self.peer_page = PeerInfoPage()
self.notebook.append_page(self.peer_page, gtk.Label(_("PeerInfo")))
# Tests page
self.test_page = TestPage()
self.notebook.append_page(self.test_page, gtk.Label(_("Tests")))
# Feedback page
self.feedback_page = FeedbackPage()
self.notebook.append_page(self.feedback_page, gtk.Label(_("Feedback")))
# Update page
self.update_page = UpdatePage()
self.notebook.append_page(self.update_page, gtk.Label(_("Update")))
# Advanced Page
self.advanced_page = AdvancedPage()
self.notebook.append_page(self.advanced_page, gtk.Label(_("Advanced")))
def __pack_widgets(self):
# Search Notebook
self.vbox._pack_expand_fill(self.notebook)
self.btn_box.set_layout(gtk.BUTTONBOX_EDGE)
self.btn_box.set_spacing(3)
self.btn_box.pack_start(self.btn_box1)
self.btn_box.pack_end(self.btn_box2)
self.btn_box1.set_layout(gtk.BUTTONBOX_START)
self.btn_box1.set_spacing(3)
self.btn_box1.pack_start(self.help_button)
self.btn_box2.set_layout(gtk.BUTTONBOX_END)
self.btn_box2.set_spacing(3)
self.btn_box2.pack_end(self.ok_button)
#self.btn_box.pack_start(self.apply_button)
self.btn_box2.pack_end(self.cancel_button)
self.vbox.pack_start(self.btn_box)
self.notebook.set_border_width(1)
self.vbox.set_border_width(12)
self.hpaned.pack1(self.vbox, True, False)
def clicked_ok(self):
self.save_preference()
self.destroy()
def save_preference(self):
""""""
self.save_peer()
self.save_general()
self.save_tests()
self.save_updates()
self.save_advanced()
def load_preference(self):
""""""
self.load_peer()
self.load_general()
self.load_tests()
self.load_updates()
#.........这里部分代码省略.........