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


Python VBox.pack_start方法代码示例

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


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

示例1: command_dialog

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class command_dialog(Window):

    def __init__(self, icon):

        Window.__init__(self, WINDOW_TOPLEVEL)
        self.set_property("skip-taskbar-hint", True)
        self.set_property("destroy-with-parent", True)
        self.set_modal(True)
        self.set_position(WIN_POS_CENTER)

        self.vbox = VBox(False, 0)
        
        self.terminal = terminal()
        self.terminal.connect("child-exited",
                              lambda _: self.close_button.show())
        self.terminal.show()
        
        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        self.vbox.pack_start(self.terminal, False, False, 0)
        self.vbox.pack_start(self.close_button, False, False, 0)
        self.vbox.show()

        self.add(self.vbox)

        self.set_icon(pixbuf_new_from_file(icon))

    def run(self, command):
        self.show()
        
        self.terminal.fork_command()
        self.terminal.feed_child("pacman --noconfirm -%s;exit\n" %command)
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:35,代码来源:dialogs.py

示例2: MenuWindow

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class MenuWindow(Window, HasMenuDialog):
    def __init__(self, name='MenuVBoxWindow'):
        Window.__init__(self)
        self.set_name(name)
        self.vbox = VBox()
        self.add(self.vbox)
        self.menubar = SimpleMenuBar()
        self.vbox.pack_start(self.menubar, False, False, 0)
        self.vbox.show()
        self.show()
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:12,代码来源:windows.py

示例3: GeoResult

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class GeoResult(ScrolledWindow):
    
    def __init__(self):
        
        ScrolledWindow.__init__(self)
        
        self.set_policy(POLICY_NEVER, POLICY_ALWAYS)
        
        self.box = VBox()
        
        self.add_with_viewport(self.box)
        
    
    def add_cache(self, cache):
        
        self.box.pack_start(GtkCache(cache))
        
    '''
开发者ID:LinusU,项目名称:geocache,代码行数:20,代码来源:GeoResult.py

示例4: MenuWindowOrig

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class MenuWindowOrig(Window):
    def __init__(self, name='MenuVBoxWindow'):
        Window.__init__(self)
        self.set_name(name)
        self.vbox = VBox()
        self.add(self.vbox)
        self.menubar = SimpleMenuBar()
        self.vbox.pack_start(self.menubar, False, False, 0)
        self.vbox.show()
        self.show()

    def add_menu(self, commands, name, function, radio=False):
        if radio:
            new_menu = RadioMenu(commands, function)
        else:
            new_menu = SimpleMenu()
            for command in commands:
                new_menu.add(command, function)
        self.menubar.append(new_menu, name)
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:21,代码来源:windows.py

示例5: main

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
def main():
    print 'answer', input_entry_dialog("who what?", 'edit me')

    gtk_info_message("hi there missy")

    w = Window()
    w.resize(200, 200)
    w.connect( "delete-event", main_quit )
    vbox = VBox()
    w.add(vbox)
    ONE_DAY = timedelta(days=1)
    existing_list = [PersistentList(test_program_return_new_row())]
    model, tv, tv_vbox = \
        create_editable_type_defined_listview_and_model(
        ( ('date', date,),
          ('choose-me',
           (True, str, 'yo', 'hi', 'me', 'fun')
           ), # end choose-me tuple
          ('choose-me-only',
           (False, str, 'yo', 'hi', 'me', 'fun')
           ), # end choose-me-only tuple
          ('choose-me-num',
           (False, int, 1, 2, 3, 4)
           ), # end choose-num tuple
          ('description', str),
          ('count', int),
          ('file_path', {'type': file,
                         'file_type':FILE_CHOOSER_ACTION_SELECT_FOLDER} ),
          ('choose-me-date',
           (False, date,
            date.today() - ONE_DAY, date.today(), date.today() + ONE_DAY ) ),
          ('choose-me-obj',
           (False, (None, TestProgType(), TestProgType()),
            'None', 'obj 1', 'obj 2' ) ),
          ('choose-me-Decimal',
           (True, Decimal, '3.1', '3.4') ),
          ), # end type tuple
        test_program_return_new_row, existing_list, test_prog_list_changed,
        False
        ) # create_editable_type_defined_listview_and_model
    vbox.pack_start( tv_vbox )
    w.show_all()
    gtk_main()
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:45,代码来源:gtkutil.py

示例6: initXdbox

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
 def initXdbox(self):
     self.xdbox=Window()
     try:
         self.xdbox.set_title(str(self.node))
     except:
         pass
     vbox=VBox()
     self.xdbox.expr=MDSplusExprWidget()
     vbox.pack_start(self.xdbox.expr,True,True,20)
     close=Button(stock=STOCK_CLOSE)
     close.connect("clicked",self.xdbox_close)
     redo=Button(stock=STOCK_REDO)
     redo.connect("clicked",self.xdbox_redo)
     cancel=Button(stock=STOCK_CANCEL)
     cancel.connect("clicked",self.xdbox_cancel)
     hbox=HBox()
     hbox.pack_start(close,False,False,20)
     hbox.pack_start(redo,False,False,20)
     hbox.pack_start(cancel,False,False,20)
     vbox.pack_start(hbox,False,False,20)
     self.xdbox.add(vbox)
     self.xdbox.expr.set_text(self.node_value())
开发者ID:LucyScott,项目名称:mdsplus,代码行数:24,代码来源:mdsplusnidoptionwidget.py

示例7: __init__

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
 def __init__(self, node=None, value=None):
     Window.__init__(self)
     MDSplusWidget.__init__(self)
     if node is not None:
         self.node = node
     else:
         self.value = value
     hbtop = HBox(homogeneous=False)
     self.on = CheckButton(label="On")
     self.parent_on = CheckButton(label="Parent")
     self.parent_on.set_sensitive(False)
     self.path = MDSplusPathWidget()
     if node is not None:
         self.path._node = self._node
     hbtags = HBox(homogeneous=False)
     self.tags = Entry()
     self.tags.set_width_chars(60)
     expression_menu = self.dtype_menu(tuple(), varname="dtype_expression", no_show=True)
     axis_menu = self.dtype_menu(("Range",), varname="dtype_axis", no_show=True)
     window_menu = self.dtype_menu(("Window",), varname="dtype_window", no_show=True)
     dispatch_menu = self.dtype_menu(("Dispatch",), varname="dtype_dispatch", no_show=True)
     action_menu = self.dtype_menu(("Action",), varname="dtype_action", no_show=True)
     task_menu = self.dtype_menu(("Method", "Routine"), varname="dtype_task", no_show=True)
     any_menu = self.dtype_menu(
         ("Range", "Window", "Dispatch", "Action", "Method", "Routine"), varname="dtype_any", no_show=True
     )
     menus = (
         self.dtype_expression,
         self.dtype_axis,
         self.dtype_dispatch,
         self.dtype_action,
         self.dtype_task,
         self.dtype_window,
         self.dtype_any,
     )
     hbtop.pack_start(self.on, False, False, 10)
     hbtop.pack_start(self.parent_on, False, False, 10)
     hbtop.pack_start(self.path, False, False, 0)
     hbtags.pack_start(Label("Tags:"), False, False, 10)
     hbtags.pack_start(self.tags, False, False, 0)
     self.action = MDSplusActionWidget()
     self.windoww = MDSplusWindowWidget()
     self.sequential = MDSplusSequentialWidget()
     self.expression = MDSplusExpressionWidget()
     self.method = MDSplusMethodWidget()
     self.routine = MDSplusRoutineWidget()
     self.dispatch = MDSplusDispatchWidget()
     self.range = MDSplusRangeWidget()
     self.widgets = (
         self.action,
         self.sequential,
         self.expression,
         self.method,
         self.routine,
         self.dispatch,
         self.range,
         self.windoww,
     )
     self.ok = Button(stock=STOCK_OK)
     self.cancel = Button(stock=STOCK_CANCEL)
     self.redo = Button(stock=STOCK_REDO)
     self.ok.connect("clicked", self.do_ok)
     self.cancel.connect("clicked", self.do_cancel)
     self.redo.connect("clicked", self.do_redo)
     hb2 = HBox()
     hb2.add(self.ok)
     hb2.add(self.redo)
     hb2.add(self.cancel)
     vb = VBox(homogeneous=False)
     vb.set_border_width(10)
     vb.pack_start(hbtop, False, False, 0)
     vb.pack_start(hbtags, False, False, 0)
     vb.pack_start(expression_menu, False, False, 0)
     vb.pack_start(axis_menu, False, False, 0)
     vb.pack_start(window_menu, False, False, 0)
     vb.pack_start(dispatch_menu, False, False, 0)
     vb.pack_start(action_menu, False, False, 0)
     vb.pack_start(task_menu, False, False, 0)
     vb.pack_start(any_menu, False, False, 0)
     for w in self.widgets:
         w.set_no_show_all(True)
         vb.pack_start(w, False, False, 0)
     vb.pack_start(hb2, False, False, 20)
     self.add(vb)
     self.do_redo(self.redo)
     self.putOnApply = True
     self.nidOffset = -1
开发者ID:LucyScott,项目名称:mdsplus,代码行数:89,代码来源:mdsplusxdbox.py

示例8: upgrade_dialog

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class upgrade_dialog(Window):

    def __init__(self, to_upgrade, icon):

        Window.__init__(self, WINDOW_TOPLEVEL)
        self.set_property("skip-taskbar-hint", True)
        self.set_property("modal", True)
        self.set_property("destroy-with-parent", True)
        self.set_position(WIN_POS_CENTER)
        self.set_default_size (300, 300)

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

    def _setup_layout(self):
        self.vbox = VBox(False, 0)
        self.vbox.show()

        self.terminal = terminal()
        self.terminal.connect("child-exited", lambda _: self.close_button.show())
        
        self.expander = expander_new_with_mnemonic(_("_Terminal"))
        self.expander.set_expanded(False)
        self.expander.add(self.terminal)
        self.expander.show_all()
        
        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        scr = ScrolledWindow()
        scr.set_policy ("automatic", "automatic")
        scr.add (self.tree)
        scr.show()

        vpaned = VPaned()
        vpaned.add1(scr)
        vpaned.add2(self.expander)
        vpaned.set_position (260)
        vpaned.show()

        self.vbox.pack_start(vpaned, True, True, 0)
        self.vbox.pack_start(self.close_button, False, False, 0)

        self.add(self.vbox)
        return

    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.show()

        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)
        return
    
    def run(self):
        self.show()
        self.terminal.do_upgrade()
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:72,代码来源:dialogs.py

示例9: do_dialog

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]

#.........这里部分代码省略.........

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

            self.inst_model.append([image, pac.name, pac.version])
            continue

        self.inst_tree = TreeView()

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

    def _setup_remove_tree(self, remove_queue):

        self.rem_model = ListStore(str, str, str)

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

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

        self.rem_tree = TreeView()

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

        self.rem_tree.set_model(self.rem_model)

    def _set_size (self, widget, event, data=None):
        if self.expander.get_expanded():
            self.size = self.get_size()
            self.expander.add(self.terminal)
            self.terminal.show()
        else:
            self.expander.remove(self.terminal)
            self.resize(self.size[0], self.size[1])
            self.show_all()

    def _setup_layout(self):

        self.hpaned = HPaned()
        self.hpaned.add1(self.inst_tree)
        self.hpaned.add2(self.rem_tree)
        self.hpaned.show_all()

        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        self.terminal = terminal()
        self.terminal.connect("child-exited", lambda _: self.close_button.show())

        self.expander = Expander(_("Terminal"))
        self.expander.connect("notify::expanded", self._set_size)
        self.expander.show()

        self.vbox = VBox(False, 0)
        self.vbox.show()
        
        self.vbox.pack_start(self.hpaned, False, False, 0)
        self.vbox.pack_start(self.expander, False, False, 0)
        self.vbox.pack_start(self.close_button, False, False, 0)

        
        self.add(self.vbox)

    def run(self):

        self.show()
        self.terminal.do(self.queues)
        return

    def _stop_closing(self, widget, event):
        self.stop_emission("delete-event")
        return True
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:104,代码来源:dialogs.py

示例10: Base

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class Base(object):
    def __init__(self):
        from gtk import Window,WINDOW_TOPLEVEL,Button,Label,HBox,Entry,VBox,VSeparator
        self.window =  Window(WINDOW_TOPLEVEL)
        self.window.set_title("Slideshow")
        self.window.connect("delete_event", self.delete_event)
        self.window.set_border_width(10)
        self.vbox = VBox(False, 0)
        self.window.add(self.vbox)
        self.hbox1 = HBox(False, 0)
        self.vbox.pack_start(self.hbox1, True, True, 1)
        self.hbox = HBox(False, 0)
        self.vbox.pack_start(self.hbox, False, False, 1)
        self.hbox2 = HBox(False, 0)
        self.vbox.pack_start(self.hbox2, True, True, 1)
        self.label = Label('Identifikační číslo:')
        self.hbox.pack_start(self.label, False, False, 1)
        self.label.show()
        self.editable = Entry()
        self.editable.connect('key_press_event', self.key_press_event)
        self.hbox.pack_start(self.editable, True, True, 1)
        self.editable.show()
        self.button = Button("Začít")
        self.button.connect("clicked", self.callback)
        self.button.set_receives_default(True)
        self.button.set_can_focus(True)
        self.hbox.pack_start(self.button, False, False, 1)
        self.button.show()
        self.hbox1.show()
        self.hbox.show()
        self.hbox2.show()
        self.vbox.show()
        self.window.show()
    def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False
    def key_press_event(self, widget, event):
        from gtk.gdk import keyval_from_name,keyval_name
        if event.keyval in (keyval_from_name('Return'),keyval_from_name('KP_Enter')):
            self.callback(widget)
    def _getFilePaths(self, fileTypes, recursive=True):
        import os
        import re
        from sys import argv
        pt = re.compile(r'.*([%(0)s][^%(0)s]*)'%{'0':os.path.extsep})
        path = [a for m,a in ((pt.match(os.path.basename(a)),a) for a in argv[1:]) if m and m.group(1) in fileTypes]
        if not path:
            path = '/home/pi/img/*.jpg'
        if isinstance(path, str):
            ## Returns list containing paths of files in /path/ that are of a file type in /fileTypes/,
            ##	if /recursive/ is False subdirectories are not checked.
            paths = []
            if recursive:
                for root, folders, files in os.walk(path, followlinks=True):
                    for file in files:
                        for fileType in fileTypes:
                            if file.endswith(fileType):
                                paths.append(os.path.join(root, file))
            else:
                for item in os.listdir(path):
                    for fileType in fileTypes:
                        if item.endswith(fileType):
                            paths.append(os.path.join(root, item))
            return paths
        elif iterable(path):
            return path
        else:
            return []
    def _init_cb(self,trans):
        from threading import Thread
        if not iterable(trans):
            trans = trans,
        callbacks  = []
        for name,cb in trans:
            t = Thread(target=cb, name='%sThread'%name)
            t.daemon = True
            t.start()
            callbacks.append(cb.enqueue)
        def wrap(msg):
            for cb in callbacks:
                if not cb(msg):
                    return False
            return True
        return wrap
    def callback(self, widget):
        from slideshow import SlideShow
        from trans import Message,GpioTransceiver,JsonTransceiver

        if not self.editable.get_text():
            return False
        img_cbs = self._init_cb([('ImgGpioCallback',GpioTransceiver(24)),('ImgJsonCallback',JsonTransceiver('img.json'))])
        kp_cbs = self._init_cb([('KpGpioCallback',GpioTransceiver(26,bcd=False)),('KpJsonCallback',JsonTransceiver('kp.json'))])
        def ordfnc(path):
            from numpy.random import permutation
            gray = path[0]
            result = []
            for p in permutation(path[1:]):
                result.append(p)
                result.append(gray)
            return result
#.........这里部分代码省略.........
开发者ID:pborky,项目名称:pyslides,代码行数:103,代码来源:startslideshow.py

示例11: create_editable_type_defined_listview_and_model

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
def create_editable_type_defined_listview_and_model(
    field_list, new_row_func, parralell_list, change_register,
    readonly=False,
    insert_pre_hook=null_function, insert_post_hook=null_function,
    change_pre_hook=null_function, change_post_hook=null_function,
    del_pre_hook=null_function, del_post_hook=null_function):
    vbox = VBox()
    tv = TreeView()
    model = ListStore( * chain((display_fieldtype_transform(fieldtype)
                                for fieldname, fieldtype in field_list),
                               (store_fieldtype_transform(fieldtype)
                                for fieldname, fieldtype in field_list)
                               ) # chain
                         ) # ListStore
    # it is important to do this fill of the liststore
    # with the existing items first prior to adding event handlers
    # (row-changed, row-inserted, row-deleted) that
    # look for changes and keep the two lists in sync
    for list_row in parralell_list:
        model.append(
            tuple(transform_list_row_into_twice_repeated_row_for_model(
                    list_row, field_list) )
            ) # append
    if not readonly:
        model.connect("row-changed",
                      row_changed_handler,
                      parralell_list, change_register, field_list,
                      change_pre_hook, change_post_hook,
                      )
        model.connect("row-inserted",
                      row_inserted_handler,
                      parralell_list, change_register,
                      insert_pre_hook, insert_post_hook )
        model.connect("row-deleted",
                      row_deleted_handler, parralell_list, change_register,
                      del_pre_hook, del_post_hook)

    for i, (fieldname, fieldtype) in enumerate(field_list):
        def setup_edited_handler_for_renderer_to_original_model(cell_renderer):
            cell_renderer.connect(
                'edited',
                cell_edited_update_original_modelhandler, model, i,
                field_list[i][FIELD_TYPE])
            return cell_renderer

        if fieldtype == date:
            cell_renderer = \
                setup_edited_handler_for_renderer_to_original_model(
                CellRendererDate() )
        elif type(fieldtype) == tuple:
            cell_renderer = CellRendererCombo()
            cell_renderer.set_property("has-entry",
                                       fieldtype[COMBO_TYPE_HAS_ENTRY_FIELD])
            combo_liststore = ListStore(
                str, store_fieldtype_transform(fieldtype) )
            for combo_string, combo_value in \
                    combobox_list_strings_and_values_iteration(fieldtype):
                combo_liststore.append( (combo_string, combo_value) )
            cell_renderer.set_property("model", combo_liststore)
            cell_renderer.set_property("text-column", 0)
            if fieldtype[COMBO_TYPE_HAS_ENTRY_FIELD]:
                setup_edited_handler_for_renderer_to_original_model(
                    cell_renderer)
            else:
                lookup_dict = dict(
                    combobox_list_strings_and_values_iteration(fieldtype) )
                cell_renderer.connect(
                'edited',
                combo_cell_edited_update_original_modelhandler, model, i,
                lookup_dict)

        elif type(fieldtype) == dict and fieldtype['type'] == file:
            cell_renderer = CellRendererFile(
                fieldtype['file_type']  if 'file_type' in fieldtype
                else FILE_CHOOSER_ACTION_OPEN 
                )
            setup_edited_handler_for_renderer_to_original_model(cell_renderer)
        else:
            cell_renderer = \
                setup_edited_handler_for_renderer_to_original_model(
                CellRendererText() )
        if not readonly:
            cell_renderer.set_property("editable", True)
            cell_renderer.set_property("editable-set", True)
        tvc = TreeViewColumn(fieldname, cell_renderer, text=i)
        tv.append_column(tvc)
    vbox.pack_start(tv)
    tv.set_model(model)
    hbox = HBox()
    buttons = [ pack_in_stock_but_and_ret(start_stock_button(code), hbox)
                for code in (STOCK_ADD, STOCK_DELETE) ]
    if readonly: 
        for button in buttons:
            button.set_property("sensitive", False)
    else:
        buttons[0].connect(
            "clicked",
            editable_listview_add_button_clicked_handler,
            model, new_row_func, field_list  )
        buttons[1].connect(
#.........这里部分代码省略.........
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:103,代码来源:gtkutil.py

示例12: multipage_glade_editor

# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import pack_start [as 别名]
class multipage_glade_editor(object):
    def __init__(self,
                 trans, transid, plugin, gui_parent, change_register_function,
                 book, display_mode=TRANSACTION_ALL_EDIT_FIRST_TIME,
                 transaction_edit_finished_function=null_function):
        self.trans = trans
        self.transid = transid
        self.plugin = plugin
        self.gui_parent = gui_parent
        self.change_register_function = change_register_function
        self.book = book
        self.display_mode = display_mode
        self.transaction_edit_finished_function = (
            null_function if display_mode not in HEADLESS_MODES
            else transaction_edit_finished_function )

        self.hide_parent = Window()
        self.hide_parent.hide()
        self.mainvbox = VBox()
        self.hide_parent.add(self.mainvbox)

        config = self.trans.get_configuration_and_provide_on_load_hook()
        config_module_name = self.plugin.config_module_name
        if not config_valid(config):
            # even in the case of a broken config, we should still
            # display all of the data we have available...
            self.mainvbox.pack_start(Label("no configuration"))
        elif not self.trans.can_safely_proceed_with_config_module(config):
            # should display all data that's available instead of just
            # this label
            #
            # and should give
            # user an overide option where they either pick an old config
            # for one time use or just blow out the memory of having used
            # a different config...
            #
            # should also print the checksum itself so they know
            # what they need...
            #
            # perhaps eventually we even put in place some archival support
            # for saving old glade and config files and then code into the
            # the transaction -- hey, code you need to be editable is
            # over here..
            #
            # now hopefully there is no marking of this transaction dirty
            # in this mode and the extra safegaurds we put into
            # MultipageGladeTransaction don't get activated
            self.mainvbox.pack_start(
                Label("out of date configuration. data is read only here for "
                      "the safety of your old information, last adler "
                      "CRC was %s" % self.trans.config_crc_cache ))
        else:
            # if the safety cache was relied on before we need to tell the
            # backend that the transaction is actually dirty,
            # and now that we know that we have a workable config,
            # there's a chance that we'll actually be able to avoid
            # relying on the cache this time
            if self.trans.get_safety_cache_was_used():
                self.change_register_function()

            self.page_label = Label("")
            (x_align, y_align) = self.page_label.get_alignment()
            self.page_label.set_alignment(0.0, y_align)
            self.mainvbox.pack_start(self.page_label, expand=False)

            # establish maincontainer, which is where the actual glade
            # pages are put by attach_current_page
            #
            # The order of placement here is important, we place this
            # after page_label has already been added to main
            # and we also need to do this prior to attach_current_page
            # being called, as it depends on self.maincontainer being
            # there
            #
            # when we're in headless mode the maincontainer can just be
            # the mainvbox itself
            #
            # but, outside headless mode we save screen real-estate and
            # place a scrolled window (which becomes the maincontainer)
            # inside the mainvbox and the glade by glade pages end up
            # in there instead (again, in attach_current_page)
            if display_mode in HEADLESS_MODES:
                self.maincontainer = self.mainvbox
            else:
                self.maincontainer = Viewport()
                sw = ScrolledWindow()
                sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
                sw.add( self.maincontainer)
                self.mainvbox.pack_start(sw)

            self.glade_pages = [
                self.__setup_page(glade_file, top_glade_element)
                for glade_file, top_glade_element in config.pages ]
            self.glade_pages_by_ident_index = dict(
                ( (key, self.glade_pages[i])
                  for i, key in enumerate(config.pages)
                  ) # end generator expression
                ) # end dict
            
            self.__setup_auto_widgets()
#.........这里部分代码省略.........
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:103,代码来源:multipageglade.py


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