Python gtk 模块,HBox() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用gtk.HBox()

项目:ns3-rdma    作者:bobzhuyb    | 项目源码 | 文件源码
def run(self, graphic):
        window = gtk.Window()
        self.__window = window
        window.set_default_size(200, 200)
        vbox = gtk.VBox()
        window.add(vbox)
        render = GtkGraphicRenderer(graphic)
        self.__render = render
        vbox.pack_end(render, True, True, 0)
        hbox = gtk.HBox()
        vbox.pack_start(hbox, False, False, 0)
        smaller_zoom = gtk.Button("Zoom Out")
        smaller_zoom.connect("clicked", self.__set_smaller_cb)
        hbox.pack_start(smaller_zoom)
        bigger_zoom = gtk.Button("Zoom In")
        bigger_zoom.connect("clicked", self.__set_bigger_cb)
        hbox.pack_start(bigger_zoom)
        output_png = gtk.Button("Output Png")
        output_png.connect("clicked", self.__output_png_cb)
        hbox.pack_start(output_png)
        window.connect('destroy', gtk.main_quit)
        window.show_all()
        #gtk.bindings_activate(gtk.main_quit, 'q', 0)
        gtk.main()
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_text_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        entry_text = gtk.Entry()
        entry_text.set_text(value)
        hbox_main.pack_start(label_text)
        hbox_main.pack_start(entry_text)

        self.plugin_config_widgets.append(entry_text)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(entry_text)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_number_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        adjustment = gtk.Adjustment(value, 0, sys.maxint, 1)
        spinbutton_value = gtk.SpinButton(adjustment)
        spinbutton_value.set_value(value)
        hbox_main.pack_start(label_text)
        hbox_main.pack_start(spinbutton_value)

        self.plugin_config_widgets.append(spinbutton_value)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(spinbutton_value)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_path_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        entry_filepath = gtk.Entry()
        entry_filepath.set_text(value)
        button_select_folder = gtk.ToolButton(
            gtk.image_new_from_file(os.path.join(definitions.ICONS_DIR, "open_small.png")))
        button_select_folder.connect("clicked", self.select_folder, entry_filepath)
        hbox_main.pack_start(label_text)
        hbox_main.pack_start(entry_filepath)
        hbox_main.pack_start(button_select_folder)

        self.plugin_config_widgets.append(entry_filepath)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(entry_filepath)
        sensitivity_group.append(button_select_folder)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_filepath_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        entry_filepath = gtk.Entry()
        entry_filepath.set_text(value)
        button_select_folder = gtk.ToolButton(
            gtk.image_new_from_file(os.path.join(definitions.ICONS_DIR, "open_small.png")))
        button_select_folder.connect("clicked", self.select_file, entry_filepath)
        hbox_main.pack_start(label_text)
        hbox_main.pack_start(entry_filepath)
        hbox_main.pack_start(button_select_folder)

        self.plugin_config_widgets.append(entry_filepath)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(entry_filepath)
        sensitivity_group.append(button_select_folder)

        return hbox_main
项目:Micro-Pi    作者:Bottersnike    | 项目源码 | 文件源码
def __init__(self):
        imageLoc = random.choice(os.listdir(os.path.join(WORKINGDIR, "data", "splashScreens")))
        imageSize = self.get_image_size(open(os.path.join(WORKINGDIR, "data", "splashScreens", imageLoc), 'rb').read())

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_decorated(False)
        self.window.set_title("Micro:Pi")
        self.window.set_icon_from_file(os.path.join(WORKINGDIR, "data", "icon.png"))
        self.window.set_size_request(imageSize[0], -1)
        self.window.set_position(gtk.WIN_POS_CENTER)
        main_vbox = gtk.VBox(False, 1)
        self.window.add(main_vbox)
        hbox = gtk.HBox(False, 0)
        self.img = gtk.Image()
        self.img.set_from_file(os.path.join(WORKINGDIR, "data", "splashScreens", imageLoc))
        main_vbox.pack_start(self.img, True, True)
        self.lbl = gtk.Label('')
        font = pango.FontDescription("Monospace 7")
        self.lbl.modify_font(font)
        main_vbox.pack_end(self.lbl, False, False)
        self.refresh()
        self.window.show_all()
        self.refresh()
项目:griffith    作者:Strit    | 项目源码 | 文件源码
def _fill_container(container, items, options, id_name):
    for item in items:
        hbox = gtk.HBox()

        label_id = gtk.Label()
        label_id.set_text(str(getattr(item, id_name)))
        hbox.pack_start(label_id, expand=False)

        widget = gtk.RadioButton(label=options[0]) # first widget
        hbox.pack_start(widget, expand=False, padding=4)
        for option in options[1:]: # create rest of the widgets, use first one as a group
            next_widget = gtk.RadioButton(widget, label=option)
            hbox.pack_start(next_widget, expand=False, padding=4)

        label = gtk.Label()
        label.set_text(item.name)
        hbox.pack_start(label, padding=16, expand=False)

        hbox.show_all()
        label_id.hide()
        container.pack_start(hbox)
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def _setup_onionskin(self):
        stock_size = gtk.ICON_SIZE_BUTTON
        button_size = 30
        onionskin_bar = gtk.HBox()

        # active onionskin
        b_active = Utils.toggle_button_stock(gtk.STOCK_DND_MULTIPLE,stock_size)

        # connect widgets
        b_active.connect("clicked",self.on_onionskin)

        # tooltips
        b_active.set_tooltip_text("enable/disable the onion skin effect")

        # add to the disable on play list
        w = [b_active]
        map(lambda x: self.widgets_to_disable.append(x),w)

        # packing everything in gbar
        map(lambda x: onionskin_bar.pack_start(x,False,False,0),w)

        return onionskin_bar
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_label(self):
        self.label = gtk.HBox(False, 0)

        self.text_label = gtk.Label("")
        self.text_label.show()
        self.label.pack_start(self.text_label, 1, 1, 1)

        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        button.set_focus_on_click(False)

        icon = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        icon.show()
        button.add(icon)

        button.connect("clicked", lambda x: self.emit("want-close"))
        button.show()
        self.label.pack_start(button, 0, 0, 0)

        self.label.show()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, columns):
        gtk.HBox.__init__(self, True, 0)

        self.columns = columns

        types = tuple([x for x, y in columns])

        self.__store = gtk.ListStore(*types)
        self.__view = gtk.TreeView(self.__store)

        self.pack_start(self.__view, 1, 1, 1)

        self.__toggle_connected = False

        self._make_view()
        self.__view.show()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_callsigns(self):
        box = gtk.HBox(True, 2)

        fixed = self.rthread.radio.get_features().has_implicit_calls

        frame = gtk.Frame(_("Your callsign"))
        self.editor_ucall = CallsignEditor(first_fixed=fixed)
        self.editor_ucall.set_size_request(-1, 200)
        self.editor_ucall.show()
        frame.add(self.editor_ucall)
        frame.show()
        box.pack_start(frame, 1, 1, 0)

        frame = gtk.Frame(_("Repeater callsign"))
        self.editor_rcall = CallsignEditor(first_fixed=fixed)
        self.editor_rcall.set_size_request(-1, 200)
        self.editor_rcall.show()
        frame.add(self.editor_rcall)
        frame.show()
        box.pack_start(frame, 1, 1, 0)

        frame = gtk.Frame(_("My callsign"))
        self.editor_mcall = CallsignEditor()
        self.editor_mcall.set_size_request(-1, 200)
        self.editor_mcall.show()
        frame.add(self.editor_mcall)
        frame.show()
        box.pack_start(frame, 1, 1, 0)

        box.show()
        return box
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def add_field(self, label, widget, validator=None):
        box = gtk.HBox(True, 2)

        lab = gtk.Label(label)
        lab.show()

        widget.set_size_request(150, -1)
        widget.show()

        box.pack_start(lab, 0, 0, 0)
        box.pack_start(widget, 0, 0, 0)
        box.show()

        # pylint: disable-msg=E1101
        self.vbox.pack_start(box, 0, 0, 0)

        self.__fields[label] = widget
项目:flashplayer-pygtk    作者:nanpuyue    | 项目源码 | 文件源码
def open_file():
    window = main_window('toplevel', 'Flash Player', 550, 400)
    vbox = gtk.VBox()
    hbox = gtk.HBox()
    button = gtk.Button("????")
    button.set_size_request(200, 70)
    button.connect("clicked", on_open_clicked, window, vbox)
    vbox.pack_start(hbox, fill=False)
    hbox.pack_start(button, fill=False)
    window.add(vbox)
    window.show_all()
项目:hardened-centos7-kickstart    作者:fcaviggia    | 项目源码 | 文件源码
def get_password(self,parent):
        dialog = gtk.Dialog("Configure System Password",parent,gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,(gtk.STOCK_CANCEL,gtk.RESPONSE_REJECT,gtk.STOCK_OK,gtk.RESPONSE_ACCEPT))
        self.pass1 = gtk.HBox()
                self.label1 = gtk.Label("          Passsword: ")
                self.pass1.pack_start(self.label1,False,True,0)
        self.password1 = gtk.Entry()
        self.password1.set_visibility(False)
        self.pass1.pack_start(self.password1,False,True,0)
        dialog.vbox.add(self.pass1)
        self.pass2 = gtk.HBox()
                self.label2 = gtk.Label("  Verify Password: ")
                self.pass2.pack_start(self.label2,False,True,0)
        self.password2 = gtk.Entry()
        self.password2.set_visibility(False)
        self.pass2.pack_start(self.password2,False,True,0)
        dialog.vbox.add(self.pass2)
        dialog.show_all()
        response = dialog.run()
        if response == gtk.RESPONSE_ACCEPT:
            self.a = self.password1.get_text()
            self.b = self.password2.get_text()
            dialog.destroy()
        else:
            self.a = ''
            self.b = ''
            dialog.destroy()


    # Configure Network Dialog
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def fill_bases(self, baseExplorers):
        box = gtk.HBox()
        for b in baseExplorers:
            box.add(b.newAttributeWidget(self))
        row = self.propertyLabels.get('bases')[0]
        self.subtable["properties"].attach(box, 1, 2, row, row+1)
        box.show_all()
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_checkbox_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        checkbutton_option = gtk.CheckButton(label.title())
        checkbutton_option.set_active(value)
        if label.lower() == "enabled":
            checkbutton_option.connect("toggled", self.enabled_checkbox_toggled, sensitivity_group)
        hbox_main.pack_start(checkbutton_option)

        self.plugin_config_widgets.append(checkbutton_option)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(checkbutton_option)
        self.sensitivity_groups.append(sensitivity_group)
        self.sensitivity_groups_switch.append(checkbutton_option)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_radio_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        radiobuttons = []
        if constraints is None:
            options = [value]
        else:
            options = constraints
        previous_button = None
        for option in options:
            new_button = gtk.RadioButton(previous_button, option)
            if option == value:
                new_button.set_active(True)
            radiobuttons.append(new_button)
            previous_button = new_button
        hbox_main.pack_start(label_text)
        for radiobutton in radiobuttons:
            hbox_main.pack_start(radiobutton)

        self.plugin_config_widgets.append(radiobuttons)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(radiobuttons)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_options_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        checkbuttons = []
        selected_options = value
        if constraints is None:
            options = []
        else:
            options = constraints
        for option in options:
            new_button = gtk.CheckButton(option)
            if option in selected_options:
                new_button.set_active(True)
            checkbuttons.append(new_button)
        hbox_main.pack_start(label_text)
        for checkbutton in checkbuttons:
            hbox_main.pack_start(checkbutton)

        self.plugin_config_widgets.append(checkbuttons)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(checkbuttons)

        return hbox_main
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_time_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_text = gtk.Label(label.title())
        label_text.set_alignment(0, 0.5)
        label_text.set_padding(8,8)
        adjustment = gtk.Adjustment(value, 0, sys.maxint, 1)
        spinbutton_value = gtk.SpinButton(adjustment)
        combobox_units = gtk.combo_box_new_text()
        t_value, units = self.get_time_value_and_units(value)
        spinbutton_value.set_value(t_value)
        options = ["seconds", "minutes", "hours", "days", "weeks"]
        for option in options:
            combobox_units.append_text(option)
        selected_index = options.index(units)
        combobox_units.set_active(selected_index)
        hbox_main.pack_start(label_text)
        hbox_main.pack_start(spinbutton_value)
        hbox_main.pack_start(combobox_units)

        self.plugin_config_widgets.append([spinbutton_value, combobox_units])
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_text)
        sensitivity_group.append(spinbutton_value)

        return hbox_main

    #TODO: Refactor these
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def show(self):
        """Opens a GTK window and puts the heatmap in it.  Intelligent enough to work with the GUI as well."""

        window_only = 1 #What needs to be destroyed when the window is destroyed?

        if HMAP_ENABLED and DISPLAY_ENABLED:

            def destroy():

                if window_only:
                    window.destroy()
                else:
                    gtk.main_quit()

            gtk.gdk.threads_enter()
            window = gtk.Window()
            window.set_title("Showing heatmap...")
            window.set_border_width(10)
            window.set_resizable(False)
            window.connect("delete_event", lambda w, e: destroy())

            backbone = gtk.HBox(True)
            image = gtk.Image()
            image.set_from_pixbuf(self._image_to_pixbuf(self.im))
            backbone.pack_start(image)

            window.add(backbone)
            window.show_all()
            gtk.gdk.threads_leave()

            if gtk.main_level() == 0:
                window_only = 0
                gtk.main()

        else:
            raise "HmapError", "Error loading modules or unable to display"
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def get_filename(self, w):

        def set_filename(w):
            self.filename = box.get_filename()
            self.parser = getattr(parsers, 'Parse' + parser_lst[button.get_active()])

            box.destroy()
            Thread(target = self._announce_fileparser).start()

        parser_lst = []

        #Get the names
        for key in parsers.__dict__:
            if key.find('Parse') == 0:
                pname = key[5:]

                if pname == 'Normal':           #Pretty sleazy way of hardcoding default
                    parser_lst.insert(0, pname)
                else:
                    parser_lst.append(pname)

        box = gtk.FileSelection("Select file")
        box.ok_button.connect("clicked", set_filename)
        box.cancel_button.connect("clicked", lambda w: box.destroy())
        box.set_resizable(False)

        button = gtk.combo_box_new_text()
        for text in parser_lst:
            button.append_text(text)

        button.set_active(0)

        parserbox = gtk.HBox(False)
        buttonlabel = gtk.Label('Select a Parser:')
        for obj in (buttonlabel, button):
            parserbox.pack_start(obj)

        box.action_area.pack_start(parserbox)

        box.show_all()
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def fill_bases(self, baseExplorers):
        box = gtk.HBox()
        for b in baseExplorers:
            box.add(b.newAttributeWidget(self))
        row = self.propertyLabels.get('bases')[0]
        self.subtable["properties"].attach(box, 1, 2, row, row+1)
        box.show_all()
项目:gui-o-matic    作者:mailpile    | 项目源码 | 文件源码
def _main_window_default_style(self):
        wcfg = self.config['main_window']
        vbox = gtk.VBox(False, 5)
        vbox.set_border_width(5)

        # TODO: Allow user to configure alignment of message, padding?

        lbl = gtk.Label()
        lbl.set_markup(wcfg.get('message', ''))
        lbl.set_alignment(0.5, 0.5)

        if wcfg.get('image'):
            self._set_background_image(vbox, wcfg.get('image'))

        button_box = gtk.HBox(False, 5)

        self._main_window_indicator(vbox, button_box)
        self._main_window_add_actions(button_box)
        vbox.pack_start(lbl, True, True)
        vbox.pack_end(button_box, False, True)

        self.main_window['window'].add(vbox)
        self.main_window.update({
            'vbox': vbox,
            'label': lbl,
            'buttons': button_box})

    # TODO: Add other window styles?
项目:griffith    作者:Strit    | 项目源码 | 文件源码
def add_query_widget(container, field_names, sel_qf='title', sel_comm='contains', text=''):
    hbox = gtk.HBox()

    cb = gtk.combo_box_new_text()
    select = 0
    for i, field in enumerate(QUERY_FIELDS):
        if sel_qf == field:
            select = i
        cb.append_text(field_names[field])
    cb.set_active(select)

    action_cb = gtk.combo_box_new_text()
    select = 0
    for i, command in enumerate(QUERY_COMMANDS):
        if sel_comm == command:
            select = i
        action_cb.append_text(QUERY_COMMAND_NAMES[command])
    action_cb.set_active(select)

    entry = gtk.Entry()
    entry.set_text(text)

    button = gtk.Button(stock=gtk.STOCK_DELETE)
    button.connect("clicked", lambda w: hbox.destroy())

    hbox.pack_start(cb, expand=False)
    hbox.pack_start(action_cb, expand=False)
    hbox.pack_start(entry, expand=True, padding=8)
    hbox.pack_start(button, expand=False, fill=False)
    hbox.show_all()

    container.pack_start(hbox)
项目:gnome-connection-manager    作者:mjun    | 项目源码 | 文件源码
def __init__(self, title, owner_, widget_, popup_):
        gtk.HBox.__init__(self, False, 0)

        self.title = title
        self.owner = owner_
        self.eb = gtk.EventBox()
        label = self.label = gtk.Label()
        self.eb.connect('button-press-event', self.popupmenu, label)
        label.set_alignment(0.0, 0.5)
        label.set_text(title)
        self.eb.add(label)        
        self.pack_start(self.eb)        
        label.show()        
        self.eb.show()                
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
        self.widget=widget_
        self.popup = popup_        
        close_btn = gtk.Button()
        close_btn.set_relief(gtk.RELIEF_NONE)
        close_btn.connect('clicked', self.on_close_tab, owner_)
        close_btn.set_size_request(image_w+7, image_h+6)
        close_btn.add(close_image)
        style = close_btn.get_style();
        self.eb2 = gtk.EventBox()
        self.eb2.add(close_btn)        
        self.pack_start(self.eb2, False, False)
        self.eb2.show()
        close_btn.show_all()  
        self.is_active = True
        self.show()
项目:linux-pentest-util    作者:fikr4n    | 项目源码 | 文件源码
def __init__(self, parser, max_tree_depth):
        self.parser = parser
        self._max_tree_depth = max_tree_depth
        self.search_thread = None
        self.search_lock = threading.Lock()
        self.name_entry = name_entry = gtk.Entry()
        name_entry.connect('activate', self.on_name_entry_activate)
        search_button = self.search_button = gtk.Button(stock=gtk.STOCK_FIND)
        search_button.connect('clicked', self.on_search)
        search_button.set_no_show_all(True)
        search_button.show()
        stop_button = self.stop_button = gtk.Button(stock=gtk.STOCK_STOP)
        stop_button.connect('clicked', self.stop_search)
        stop_button.set_no_show_all(True)
        self.progress = progress = gtk.ProgressBar()
        progress.set_size_request(-1, 8)
        name_box = gtk.HBox(spacing=8)
        name_box.set_border_width(8)
        name_box.pack_start(name_entry, True, True)
        name_box.pack_start(search_button, False)
        name_box.pack_start(stop_button, False)
        self.store = gtk.TreeStore(str, str, str, str)  # name, icon, fnstyle, info
        self.treeview = treeview = self._create_treeview(self.store)
        scroller = gtk.ScrolledWindow()
        scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroller.add(treeview)
        settings_view = SettingsView(max_depth_value=max_tree_depth)
        settings_view.on_max_depth_changed = self.on_max_depth_changed
        extension = gtk.expander_new_with_mnemonic('_Settings')
        extension.add(settings_view.view)
        vbox = gtk.VBox()
        vbox.pack_start(name_box, False)
        vbox.pack_start(progress, False)
        vbox.pack_start(scroller, True, True)
        vbox.pack_start(extension, False)
        self.window = window = gtk.Window()
        window.set_title(Application.title)
        window.set_default_size(800, 600)
        window.set_icon(Application.get_icon())
        window.add(vbox)
项目:linkanalysis    作者:jaap-karssenberg    | 项目源码 | 文件源码
def __init__(self, parent, notebook):
        Dialog.__init__(self, parent,
            _('Pages By Number Of Links'), # T: dialog title
            buttons=gtk.BUTTONS_CLOSE
        )
        self.notebook = notebook

        self.direction_input = gtk.combo_box_new_text()
        for dir in sorted(self.LABELS):
            self.direction_input.append_text(self.LABELS[dir])

        self.uistate.setdefault('link_direction', LINK_DIR_BACKWARD, self.LABELS.keys())
        gtk_combobox_set_active_text(
            self.direction_input,
            self.LABELS[self.uistate['link_direction']]
        )
        self.direction_input.connect('changed', self.on_direction_input_changed)

        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Trace Links')+':'), False)
        hbox.add(self.direction_input)
        self.vbox.pack_start(hbox, False)

        self.listview = SingleClickTreeView(gtk.ListStore(int, str))
        self.listview.set_reorderable(True)
        for i, label in enumerate((_('#'), _('Page'))):
            column = gtk.TreeViewColumn(label, gtk.CellRendererText(), text=i)
            column.set_sort_column_id(i)
            self.listview.append_column(column)
        # TODO: self.listview.connect('row-activated', self.on_row_activated())

        self.vbox.add(ScrolledWindow(self.listview))
        self.populate_listview()
项目:File-Explorer    作者:aj95    | 项目源码 | 文件源码
def searchfunc(self,widget):
        fileName = self.searchfile.get_text()
        paths = "\n"
        for root, dirs, files in os.walk('/home', topdown=False):
            for name in files:
                if name == fileName:
                    paths += "  " + str(os.path.join(root, name))  + "  \n\n"
            for name in dirs:
                if name == fileName:
                    paths += "  " + str(os.path.join(root, name)) + "  \n\n"
        paths = paths[:-1]
        if len(paths) > 0 :
            self.popup = gtk.Window()
            self.popup.set_title( "Paths" )
            vbox = gtk.VBox(False,0)
            hbox = gtk.HBox(False)
            label = gtk.Label(paths)
            label.set_line_wrap( True )
            label.connect( "size-allocate",self.size_allocate)
            vbox.pack_start(gtk.Label(paths),True,False,0)
            closeButton = gtk.Button(" Close ")
            closeButton.set_sensitive(True)
            closeButton.connect("clicked",self.on_destroy)
            hbox.pack_start(closeButton,True,False,0)
            vbox.pack_start(hbox,True,False,10)
            self.popup.add(vbox)
            self.popup.set_type_hint( gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
            self.popup.show_all()
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def spin_button(name="variable",number_type="int",value=0,min=1,max=100,advance=1):
        adjustment = gtk.Adjustment(value,min,max,advance,advance)
        digits = 0
        if number_type != "int":
            digits = 3
        l = gtk.Label(name)
        b = gtk.SpinButton(adjustment,0,digits)

        h = gtk.HBox()
        h.pack_start(l)
        h.pack_start(b)
        return h,adjustment
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def _setup_editbar(self):
        stock_size = gtk.ICON_SIZE_BUTTON
        edit_bar = gtk.HBox()

        b_back = Utils.button_stock(gtk.STOCK_GO_BACK,stock_size)
        b_forward = Utils.button_stock(gtk.STOCK_GO_FORWARD,stock_size)
        b_rem = Utils.button_stock(gtk.STOCK_REMOVE,stock_size)
        b_add = Utils.button_stock(gtk.STOCK_ADD,stock_size)
        b_copy = Utils.button_stock(gtk.STOCK_COPY,stock_size)

        # add to the disable on play list
        w = [b_back,b_forward,b_rem,b_add,b_copy]
        map(lambda x: self.widgets_to_disable.append(x),w)

        # connect callbacks:
        b_rem.connect("clicked",self.on_remove) # remove frame
        b_add.connect("clicked",self.on_add) # add frame
        b_copy.connect("clicked",self.on_add,True) # add frame
        b_back.connect("clicked",self.on_move,PREV)
        b_forward.connect("clicked",self.on_move,NEXT)

        # tooltips
        b_rem.set_tooltip_text("Remove a frame/layer")
        b_add.set_tooltip_text("Add a frame/layer")
        b_copy.set_tooltip_text("Duplicate the atual selected frame")
        b_back.set_tooltip_text("Move the atual selected frame backward")
        b_forward.set_tooltip_text("Move the atual selected frame forward")

        # packing everything in gbar
        map(lambda x: edit_bar.pack_start(x,False,False,0),w)

        return edit_bar
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def _setup_generalbar(self):
        stock_size = gtk.ICON_SIZE_BUTTON
        general_bar = gtk.HBox()

        b_about = Utils.button_stock(gtk.STOCK_ABOUT,stock_size)

        b_to_gif = Utils.button_stock(gtk.STOCK_CONVERT,stock_size)
        b_to_sprite = Utils.button_stock(gtk.STOCK_MISSING_IMAGE,stock_size)

        # TODO implement export button

        b_quit = Utils.button_stock(gtk.STOCK_QUIT,stock_size)

        # callbacks
        b_quit.connect('clicked',self.destroy)
        b_about.connect('clicked',self.on_about)

        b_to_gif.connect('clicked',self.create_formated_version,'gif')
        b_to_sprite.connect('clicked',self.create_formated_version,'spritesheet')

        # tooltips
        b_about.set_tooltip_text("About FAnim")
        b_quit.set_tooltip_text("Exit")
        b_to_gif.set_tooltip_text("Create a formated Image to export as gif animation")
        b_to_sprite.set_tooltip_text("Create a formated Image to export as spritesheet")

        # add to the disable on play list
        w = [b_about, b_to_gif,b_to_sprite, b_quit]
        map(lambda x: self.widgets_to_disable.append(x),w)

        # packing everything in gbar
        map(lambda x: general_bar.pack_start(x,False,False,0),w)

        return general_bar
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_status_bar(self):
        box = gtk.HBox(False, 2)

        self.sb_general = gtk.Statusbar()
        self.sb_general.set_has_resize_grip(False)
        self.sb_general.show()
        box.pack_start(self.sb_general, 1, 1, 1)

        self.sb_radio = gtk.Statusbar()
        self.sb_radio.set_has_resize_grip(True)
        self.sb_radio.show()
        box.pack_start(self.sb_radio, 1, 1, 1)

        box.show()
        return box
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def _build_ui(self):
        self._display = gtk.Table(20, 2)

        self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
        self._tree = gtk.TreeView(self._store)

        rend = gtk.CellRendererText()
        tvc = gtk.TreeViewColumn('Element', rend, text=0)
        self._tree.append_column(tvc)
        self._tree.connect('button_press_event', self._tree_click)
        self._tree.set_size_request(200, -1)

        self.root = gtk.HBox(False, 3)
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.add(self._tree)
        sw.show()
        self.root.pack_start(sw, 0, 0, 0)
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.add_with_viewport(self._display)
        sw.show()
        self.root.pack_start(sw, 1, 1, 1)
        self._tree.show()
        self._display.show()
        self.root.show()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def connect(self, signame, *args):
        if signame == "item-toggled":
            self.__toggle_connected = True

        gtk.HBox.connect(self, signame, *args)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, find_dir=False, types=[]):
        gtk.HBox.__init__(self, False, 0)

        self.types = types

        self.filename = gtk.Entry()
        self.filename.show()
        self.pack_start(self.filename, 1, 1, 1)

        browse = gtk.Button("...")
        browse.show()
        self.pack_start(browse, 0, 0, 0)

        self.filename.connect("changed", self.do_changed)
        browse.connect("clicked", self.do_browse, find_dir)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, first_fixed=False, width=8):
        gtk.HBox.__init__(self, False, 2)

        self.first_fixed = first_fixed

        self.listw = None

        self.pack_start(self.make_list(width), 1, 1, 1)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_select(self):
        hbox = gtk.HBox(True, 2)

        all = gtk.Button(_("All"))
        all.connect("clicked", self.__select_all, True)
        all.set_size_request(50, 25)
        all.show()
        hbox.pack_start(all, 0, 0, 0)

        none = gtk.Button(_("None"))
        none.connect("clicked", self.__select_all, False)
        none.set_size_request(50, 25)
        none.show()
        hbox.pack_start(none, 0, 0, 0)

        inv = gtk.Button(_("Inverse"))
        inv.connect("clicked", self.__select_all, None)
        inv.set_size_request(50, 25)
        inv.show()
        hbox.pack_start(inv, 0, 0, 0)

        frame = gtk.Frame(_("Select"))
        frame.show()
        frame.add(hbox)
        hbox.show()

        return frame
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_controls(self):
        hbox = gtk.HBox(False, 2)

        hbox.pack_start(self.make_select(), 0, 0, 0)
        hbox.pack_start(self.make_adjust(), 0, 0, 0)
        # hbox.pack_start(self.make_options(), 0, 0, 0)
        hbox.show()

        return hbox
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, rthread):
        super(SettingsEditor, self).__init__(rthread)

        # The main box
        self.root = gtk.HBox(False, 0)

        # The pane
        paned = gtk.HPaned()
        paned.show()
        self.root.pack_start(paned, 1, 1, 0)

        # The selection tree
        self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_INT)
        self._view = gtk.TreeView(self._store)
        self._view.get_selection().connect("changed", self._view_changed_cb)
        self._view.append_column(
            gtk.TreeViewColumn("", gtk.CellRendererText(), text=0))
        self._view.show()
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled_window.add_with_viewport(self._view)
        scrolled_window.set_size_request(200, -1)
        scrolled_window.show()
        paned.pack1(scrolled_window)

        # The settings notebook
        self._notebook = gtk.Notebook()
        self._notebook.set_show_tabs(False)
        self._notebook.set_show_border(False)
        self._notebook.show()
        paned.pack2(self._notebook)

        self._changed = False
        self._settings = None

        job = common.RadioJob(self._get_settings_cb, "get_settings")
        job.set_desc("Getting radio settings")
        self.rthread.submit(job)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_radio_sel(self):
        f = gtk.Frame("Radio")

        hbox = gtk.HBox(False, 2)
        hbox.set_border_width(2)

        self.w_radio = make_choice(RADIOS, False, RADIOS[0])
        self.w_radio.connect("changed", self.select_radio)
        self.tips.set_tip(self.w_radio, "Select radio model")
        self.w_radio.show()
        hbox.pack_start(self.w_radio, 1, , )

        l = gtk.Label(" on port ")
        l.show()
        hbox.pack_start(l, 0, , )

        ports = platform.get_platform().list_serial_ports()
        if len(ports) > 0:
            default = ports[0]
        else:
            default = None
        self.w_port = make_choice(ports, True, default)
        self.w_port.connect("changed", self.select_radio)
        self.tips.set_tip(self.w_port, "Select serial port")
        self.w_port.show()
        hbox.pack_start(self.w_port, 1, , )

        f.add(hbox)
        hbox.show()
        f.show()

        return f
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def make_image_ctl(self):
        self.w_imgframe = gtk.Frame("Image")

        vbox = gtk.VBox(False, 2)
        vbox.set_border_width(2)

        self.w_imginfo = gtk.Label("No image")
        self.w_imginfo.show()
        vbox.pack_start(self.w_imginfo, 0, , )

        hbox = gtk.HBox(True, 2)
        hbox.set_border_width(2)

        self.w_dli = StdButton("Download")
        self.w_dli.connect("clicked", lambda x: self.fn_download())
        self.tips.set_tip(self.w_dli, "Download image from radio")
        self.w_dli.show()
        hbox.pack_start(self.w_dli, 0, , )

        self.w_uli = StdButton("Upload")
        self.w_uli.set_sensitive(False)
        self.w_uli.connect("clicked", lambda x: self.fn_upload())
        self.tips.set_tip(self.w_uli, "Upload image to radio")
        self.w_uli.show()
        hbox.pack_start(self.w_uli, 0, , )

        hbox.show()
        vbox.pack_start(hbox, 0, , )

        vbox.show()
        self.w_imgframe.add(vbox)
        self.w_imgframe.show()
        self.w_imgframe.set_sensitive(False)

        return self.w_imgframe
项目:pub1ic_POC    作者:i1ikey0u    | 项目源码 | 文件源码
def __init__(self, width, height):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(0)
        self.window.set_size_request(width, height + 30)
        self.window.set_app_paintable(True)

        self.screen = self.window.get_screen()
        self.rgba = self.screen.get_rgba_colormap()
        self.window.set_colormap(self.rgba)
        self.window.connect('expose-event', self.expose)

        self.vbox = gtk.VBox(False, 5)
        self.hbox = gtk.HBox(False, 3)
        self.bbox = gtk.HBox(True, 3)

        self.entry = gtk.Entry()
        self.entry.set_max_length(0)
        self.entry.set_size_request(int(width / 2), 25)
        self.entry.connect("activate", self.enter_callback, self.entry)
        self.spr = gtk.ToggleButton(label='spr')
        self.spr.connect("toggled", self.on_button_toggled, 'spr')
        self.ctrl = gtk.ToggleButton(label='ctrl')
        self.ctrl.connect("toggled", self.on_button_toggled, 'ctrl')
        self.alt = gtk.ToggleButton(label='alt')
        self.alt.connect("toggled", self.on_button_toggled, 'alt')
        self.enter = gtk.Button(label='Enter')
        self.enter.connect("clicked", self.on_enter_clicked)
        self.backspace = gtk.Button(label='Backspace')
        self.backspace.connect("clicked", self.on_backspace_clicked)
        self.shell = gtk.Button(label='R-Shell')
        self.shell.connect("clicked", self.on_shell_clicked, self.entry)

        self.hbox.add(self.entry)
        self.bbox.add(self.spr)
        self.bbox.add(self.ctrl)
        self.bbox.add(self.alt)
        self.bbox.add(self.enter)
        self.bbox.add(self.backspace)
        self.bbox.add(self.shell)
        self.hbox.add(self.bbox)

        self.halign = gtk.Alignment(1, 0, 1, 0)
        self.halign.add(self.hbox)

        self.allalign = gtk.Alignment(0, 0, 1, 1)
        self.clickbox = gtk.EventBox()
        self.clickbox.connect('button-press-event', self.on_click)
        self.clickbox.set_visible_window(False)

        self.allalign.add(self.clickbox)
        self.vbox.pack_start(self.allalign, True, True, 0)

        self.vbox.pack_end(self.halign, False, False, 0)

        self.window.add(self.vbox)

        self.window.show_all()

        self.window.move(100, 100)
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def __init__(self, parent, plugins):
        super(PluginConfigGUI, self).__init__()
        self.main_gui = parent

        #TODO: Add one for compression format
        self.value_type_create = {
            "text": self.create_text_hbox,
            "number": self.create_number_hbox,
            "checkbox": self.create_checkbox_hbox,
            "radio": self.create_radio_hbox,
            "option": self.create_option_hbox,
            "options": self.create_options_hbox,
            "time": self.create_time_hbox,
            "netiface": self.create_netiface_hbox,
            "netifaces": self.create_netifaces_hbox,
            "filepath": self.create_filepath_hbox,
            "path": self.create_path_hbox
        }

        self.set_title("Plugin Configurations")
        self.set_modal(True)
        self.set_transient_for(self.main_gui)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        #self.set_size_request(500, 700)
        self.set_border_width(6)
        self.set_resizable(False)

        self.plugins = plugins
        plugin_names = [plugin.name for plugin in self.plugins]

        vbox_main = gtk.VBox()

        hbox_plugins = gtk.HBox()
        frame_plugin_confs = gtk.Frame("Plugin Configurations:")

        self.vbox_plugin_main = None

        label_plugins = gtk.Label("Plugin")
        combobox_plugins = gtk.combo_box_new_text()
        for label in plugin_names:
            combobox_plugins.append_text(label)
        combobox_plugins.set_active(0)
        combobox_plugins.connect('changed', self.select_plugin, combobox_plugins, frame_plugin_confs)

        button_close = gtk.Button("Close")
        button_close.connect("clicked", self.close_plugin_config_dialog)

        hbox_plugins.pack_start(label_plugins)
        hbox_plugins.pack_start(combobox_plugins)
        vbox_main.pack_start(hbox_plugins)
        vbox_main.pack_start(frame_plugin_confs)
        vbox_main.pack_start(button_close)

        self.show_plugin_configs(combobox_plugins.get_active_text(), frame_plugin_confs)

        self.add(vbox_main)
        self.show_all()
项目:Micro-Pi    作者:Bottersnike    | 项目源码 | 文件源码
def addNotebookPage(self, title, content, path):
        area = gtk.ScrolledWindow()
        area.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS)
        area.show()

        txtB = gtkSourceView.Buffer()
        txtB.begin_not_undoable_action()
        txtB.set_style_scheme(self.style_scheme)

        language = self.getLanguage(title)

        txtB.set_highlight_matching_brackets(True)
        if language is not None:
            txtB.set_highlight_syntax(True)
            txtB.set_language(language)

        txtB.set_text(content)
        txtB.place_cursor(txtB.get_start_iter())
        txtB.set_modified(False)
        txtB.end_not_undoable_action()

        text = SourceView(txtB)
        text.set_tab_width(self.tabWidth)
        text.set_insert_spaces_instead_of_tabs(False)
        text.set_show_right_margin(True)
        text.set_show_line_marks(True)
        text.set_auto_indent(self.autoIndent)
        text.set_show_line_numbers(self.lineNumbers)
        text.show()
        text.modify_font(pango.FontDescription('Monospace 10'))
        area.add(text)


        top = gtk.HBox()

        title = gtk.Label(title)
        title.show()
        top.set_tooltip_text(path)


        top.pack_start(title, True, True, 0)
        butt = gtk.Button()
        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        img.show()
        butt.set_image(img)
        butt.connect_object("clicked", self.closePage, area)
        top.pack_end(butt, False, False, 0)

        butt.show()
        top.show()

        self.notebook.insert_page(area, top, 0)

        pages = self.notebook.get_n_pages()
        self.notebook.set_current_page(0)
项目:Micro-Pi    作者:Bottersnike    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.window = gtk.Window()
        self.window.set_title("Create An Image")
        self.window.set_icon_from_file(os.path.join(WORKINGDIR, "data", "icon.png"))
        colour = gtk.gdk.color_parse(DARKCOL)
        self.window.modify_bg(gtk.STATE_NORMAL, colour)

        self.vvbox = gtk.VBox()
        self.table = gtk.Table(5, 5)
        self.table.set_border_width(2)
        self.table.set_row_spacings(2)
        self.table.set_col_spacings(2)
        self.buttons = {}

        for y in range(5):
            for x in range(5):
                eb = gtk.EventBox()
                i = gtk.Image()
                i.set_from_file(os.path.join(WORKINGDIR, "data", "selected.png"))
                i.show()
                eb.add(i)
                eb.hide()
                eb.modify_bg(gtk.STATE_NORMAL, colour)
                eb.connect_object("button-press-event", self.togglePart, (x, y))

                eb2 = gtk.EventBox()
                i2 = gtk.Image()
                i2.set_from_file(os.path.join(WORKINGDIR, "data", "unselected.png"))
                i2.show()
                eb2.add(i2)
                eb2.show()
                eb2.modify_bg(gtk.STATE_NORMAL, colour)
                eb2.connect_object("button-press-event", self.togglePart, (x, y))

                self.buttons[(x, y)] = (eb, eb2)

                self.table.attach(eb, x, x + 1, y, y + 1)
                self.table.attach(eb2, x, x + 1, y, y + 1)

        self.table.show()
        self.vvbox.pack_start(self.table)
        hbox = gtk.HBox()
        self.confirmButton = gtk.Button("Okay")
        self.confirmButton.show()
        self.confirmButton.connect("clicked", self.okay)
        hbox.pack_start(self.confirmButton, True, False)
        cancelButton = gtk.Button("Cancel")
        cancelButton.connect("clicked", self.destroy)
        cancelButton.show()
        hbox.pack_end(cancelButton, True, False)
        hbox.show()
        self.vvbox.pack_start(hbox)
        self.vvbox.show()
        self.window.add(self.vvbox)
        self.onOkay = None

        self.running = True
        self.destoryed = False
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def setup_gui_preferences(self):
        self.player_path = gtk.Entry()
        self.player_params = gtk.Entry()

        self.player_ao_model = gtk.ListStore(str)
        self.player_ao = gtk.ComboBox(self.player_ao_model)
        cell = gtk.CellRendererText()
        self.player_ao.pack_start(cell, True)
        self.player_ao.add_attribute(cell, "text", 0)

        for t in ("esd", "gst"):
            self.player_ao_model.append((t,))


        self.player_acodec_model = gtk.ListStore(str)
        self.player_acodec = gtk.ComboBox(self.player_acodec_model)
        cell = gtk.CellRendererText()
        self.player_acodec.pack_start(cell, True)
        self.player_acodec.add_attribute(cell, "text", 0)

        for t in ("ffmpeg", "dspmp3"):
            self.player_acodec_model.append((t,))



        hbox = gtk.HBox(homogeneous=False, spacing=2)
        btn = gtk.Button(stock=gtk.STOCK_OPEN)
        hbox.pack_start(self.player_path, fill=True, expand=True)
        hbox.pack_start(btn, fill=True, expand=False)
        btn.connect("clicked", self._choose_mplayer_path)

        hbox.show_all()

        wids = ("MPlayer",
                ("Path:", hbox),
                ("Parameters:", self.player_params),
                ("Audio Output:", self.player_ao),
                ("Audio Codec:", self.player_acodec),
                )

        self.gui_preferences = wids
    # setup_gui_preferences()
项目:hazzy    作者:KurtJacobson    | 项目源码 | 文件源码
def __init__(self, inifile, width, height):
        gobject.GObject.__init__(self)

        super(HazzyGremlin, self).__init__(inifile)

        self.width = width
        self.height = height

        self.percent = 0
        self.mouse_mode = None
        self.zoom_in_pressed = False
        self.zoom_out_pressed = False

        self.set_display_units('in')

        # Gremlin width = width - 40 to allow room for the controls
        self.set_size_request(self.width - 40, self.height)

        # Add gremlin back-plot
        self.gremlin_view = gtk.HBox()
        fixed = gtk.Fixed()
        fixed.put(self, 0, 0)
        self.gremlin_view.add(fixed)
        self.connect('button_press_event', self.on_gremlin_clicked)

        # Add touchscreen controls
        gladefile = os.path.join(UIDIR, 'controls.glade')
        self.builder = gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.builder.connect_signals(self)
        controls = self.builder.get_object('controls')
        controls.set_size_request(40, self.height)
        self.gremlin_view.add(controls)

        # Add progress label
        self.label = gtk.Label()
        self.label.modify_font(pango.FontDescription('FreeSans 11'))
        self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color('White'))
        labelbox = gtk.EventBox()
        labelbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('Black'))
        labelbox.set_size_request(-1, 20)
        labelbox.add(self.label)
        fixed.put(labelbox, 0 , self.height - 20)


#    def fileloading(self, current_line):
#        self.progressbar.show()
#        percent = current_line * 100 / self.line_count
#        if self.percent != percent:
#            self.percent = percent
#            msg = "Generating preview {}%".format(self.percent)
#            self.progressbar.set_text(msg)
#            self.progressbar.set_fraction(self.percent / 100)
#            log.debug(msg)
#            self.emit('loading_progress', percent)
项目:python-3-for-absolute-begs    作者:Apress    | 项目源码 | 文件源码
def __init__(self):
        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # This is a new call, which just sets the title of our
        # new window to "Hello Buttons!"
        self.window.set_title("Hello Buttons!")

        # Here we just set a handler for delete_event that immediately
        # exits GTK.
        self.window.connect("delete_event", self.delete_event)

        # Sets the border width of the window.
        self.window.set_border_width(10)

        # We create a box to pack widgets into.  This is described in detail
        # in the "packing" section. The box is not really visible, it
        # is just used as a tool to arrange widgets.
        self.box1 = gtk.HBox(gtk.FALSE, 0)

        # Put the box into the main window.
        self.window.add(self.box1)

        # Creates a new button with the label "Button 1".
        self.button1 = gtk.Button("Button 1")

        # Now when the button is clicked, we call the "callback" method
        # with a pointer to "button 1" as its argument
        self.button1.connect("clicked", self.callback, "button 1")

        # Instead of add(), we pack this button into the invisible
        # box, which has been packed into the window.
        self.box1.pack_start(self.button1, gtk.TRUE, gtk.TRUE, 0)

        # Always remember this step, this tells GTK that our preparation for
        # this button is complete, and it can now be displayed.
        self.button1.show()

        # Do these same steps again to create a second button
        self.button2 = gtk.Button("Button 2")

        # Call the same callback method with a different argument,
        # passing a pointer to "button 2" instead.
        self.button2.connect("clicked", self.callback, "button 2")

        self.box1.pack_start(self.button2, gtk.TRUE, gtk.TRUE, 0)

        # The order in which we show the buttons is not really important, but I
        # recommend showing the window last, so it all pops up at once.
        self.button2.show()
        self.box1.show()
        self.window.show()
项目:python-3-for-absolute-begs    作者:Apress    | 项目源码 | 文件源码
def __init__(self):
        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # This is a new call, which just sets the title of our
        # new window to "Hello Buttons!"
        self.window.set_title("Hello Buttons!")

        # Here we just set a handler for delete_event that immediately
        # exits GTK.
        self.window.connect("delete_event", self.delete_event)

        # Sets the border width of the window.
        self.window.set_border_width(10)

        # We create a box to pack widgets into.  This is described in detail
        # in the "packing" section. The box is not really visible, it
        # is just used as a tool to arrange widgets.
        self.box1 = gtk.HBox(gtk.FALSE, 0)

        # Put the box into the main window.
        self.window.add(self.box1)

        # Creates a new button with the label "Button 1".
        self.button1 = gtk.Button("Button 1")

        # Now when the button is clicked, we call the "callback" method
        # with a pointer to "button 1" as its argument
        self.button1.connect("clicked", self.callback, "button 1")

        # Instead of add(), we pack this button into the invisible
        # box, which has been packed into the window.
        self.box1.pack_start(self.button1, gtk.TRUE, gtk.TRUE, 0)

        # Always remember this step, this tells GTK that our preparation for
        # this button is complete, and it can now be displayed.
        self.button1.show()

        # Do these same steps again to create a second button
        self.button2 = gtk.Button("Button 2")

        # Call the same callback method with a different argument,
        # passing a pointer to "button 2" instead.
        self.button2.connect("clicked", self.callback, "button 2")

        self.box1.pack_start(self.button2, gtk.TRUE, gtk.TRUE, 0)

        # The order in which we show the buttons is not really important, but I
        # recommend showing the window last, so it all pops up at once.
        self.button2.show()
        self.box1.show()
        self.window.show()
项目:python-3-for-absolute-begs    作者:Apress    | 项目源码 | 文件源码
def __init__(self):
        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # Set the title of the window to "Graphic User Interface"
        self.window.set_title("Graphic User Interface")

        # Create a handler for delete_event that immediately quits GTK.
        self.window.connect("delete_event", self.delete_event)

        # Set the border width of the window.
        self.window.set_border_width(6)

        # Create a box to pack the widgets into. The box is an invisible 
        # container, which is used to arrange the widgets inside it.
        self.box1 = gtk.HBox(gtk.FALSE, 0)

        # Put the box into the main window.
        self.window.add(self.box1)

        # Create a new button with the label "Hello".
        self.button1 = gtk.Button("Hello")

        # Now when the button is clicked, we call the self.callback method 
        # with a pointer to "the Hello button" as its argument.
        self.button1.connect("clicked", self.callback, "the Hello button")

        # Instead of add(), we pack this button into the invisible box, 
        # which has been packed into the window.
        self.box1.pack_start(self.button1, gtk.TRUE, gtk.TRUE, 0)

        # Always remember this step, this tells GTK to actually display the 
        # button.
        self.button1.show()

        # Do these same steps again to create a second button
        self.button2 = gtk.Button("Quit")

        # This time, delete_event is called and the window exits.
        self.button2.connect("clicked", self.delete_event, "the Quit button")
        self.box1.pack_start(self.button2, gtk.TRUE, gtk.TRUE, 0)

        # The order in which the buttons are shown is not really important, 
        # but it is recommended to show the window last, so that everything 
        # displays at once.
        self.button2.show()
        self.box1.show()
        self.window.show()