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

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

项目: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_option_hbox(self, label, value, trace, sensitivity_group, constraints=None):
        hbox_main = gtk.HBox()
        label_options = gtk.Label(label.title())
        label_options.set_alignment(0, 0.5)
        label_options.set_padding(8,8)
        combobox_options = gtk.combo_box_new_text()
        if constraints is None:
            options = []
        else:
            options = constraints
        for option in options:
            combobox_options.append_text(option)
        selected_index = options.index(value)
        combobox_options.set_active(selected_index)
        hbox_main.pack_start(label_options)
        hbox_main.pack_start(combobox_options)

        self.plugin_config_widgets.append(combobox_options)
        self.plugin_config_traces.append(trace)
        sensitivity_group.append(label_options)
        sensitivity_group.append(combobox_options)

        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, *args, **kwargs):
        if 'default_value' in kwargs:
            default_value = kwargs['default_value']
            del kwargs['default_value']
        else:
            default_value = ''

        query = args[-1]
        args = args[:-1]

        super(EntryDialog, self).__init__(*args, **kwargs)

        label = gtk.Label(query)
        self.vbox.pack_start(label, True, True)

        entry = gtk.Entry()
        entry.set_text(str(default_value))
        entry.connect("activate",
                      lambda ent, dlg, resp: dlg.response(resp),
                      self, gtk.RESPONSE_OK)
        self.vbox.pack_end(entry, True, True, 0)
        self.vbox.show_all()
        self.entry = entry
项目: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()
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def setup_gui_url_chooser(self):
        self.media_model = gtk.ListStore(str)
        self.media_type = gtk.ComboBox(self.media_model)
        cell = gtk.CellRendererText()
        self.media_type.pack_start(cell, True)
        self.media_type.add_attribute(cell, "text", 0)

        for t in ("file", "dvd", "tv", "dvb", "vcd", "radio", "cdda", "tivo"):
            self.media_model.append((t,))

        self.media_location = gtk.Entry()
        self.media_server = gtk.Label()
        self.media_server.set_alignment(0, 0.5)

        d = catota.ui.Dialog("Choose Location", self.parent_win,
                             extra_buttons=(gtk.STOCK_PREFERENCES, 1))

        t = catota.ui.new_table((("Server:", self.media_server),
                                 ("Type:", self.media_type),
                                 ("Location:", self.media_location)))
        d.vbox.pack_start(t, True, True)

        self.gui_url_chooser = d
    # setup_gui_url_chooser()
项目:tintwizard    作者:vanadey    | 项目源码 | 文件源码
def addBgClick(self, widget=None, init=False):
        """Creates a new background and adds a new tab to the notebook."""
        n = self.bgNotebook.get_n_pages()

        if n > (self.defaults["bgCount"] + 2):
            if confirmDialog(self, "You already have %d background styles. Are you sure you would like another?" % n) == gtk.RESPONSE_NO:
                return

        self.addBg()

        newId = len(self.bgs)

        self.bgNotebook.append_page(self.bgs[newId-1], gtk.Label("Background ID %d" % (newId)))

        self.bgNotebook.show_all()

        self.updateComboBoxes(n, "add")

        self.bgNotebook.set_current_page(n)

        if not init:
            self.changeOccurred()
项目:tintwizard    作者:vanadey    | 项目源码 | 文件源码
def quit(self, widget, event=None):
        """Asks if user would like to save file before quitting, then quits the program."""
        if self.toSave:
            if self.oneConfigFile:
                response = gtk.RESPONSE_YES
            else:
                dialog = gtk.Dialog("Save config?", self, gtk.DIALOG_MODAL, (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
                dialog.get_content_area().add(gtk.Label("Save config before quitting?"))
                dialog.get_content_area().set_size_request(300, 100)
                dialog.show_all()
                response = dialog.run()
                dialog.destroy()

            if response == gtk.RESPONSE_CANCEL:
                return True                         # Return True to stop it quitting when we hit "Cancel"
            elif response == gtk.RESPONSE_NO:
                gtk.main_quit()
            elif response == gtk.RESPONSE_YES:
                self.save()
                gtk.main_quit()
        else:
            gtk.main_quit()
项目:lfde    作者:mv-code    | 项目源码 | 文件源码
def gui_add_task(self, task):
        label = gtk.Label(task.name)
        label.set_alignment(0.0, 0.0)
        row = self.task_count + 1
        col = 0  
        # col_left_attach, col_right_attach, row_top_attach, row_bottom_attach
        self.tbl_tasks.attach(label, col, col + 1, row, row + 1)
        label.show()

        col = 1 
        image = gtk.Image() 
        image.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_MENU)
        image.set_alignment(0.0, 0.0)
        self.tbl_tasks.attach(image, col, col + 1, row, row + 1)
        self.task_images.append(image)

        self.task_count += 1
项目: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)
项目:linux-pentest-util    作者:fikr4n    | 项目源码 | 文件源码
def __init__(self, max_depth_value):
        self.on_max_depth_changed = None
        max_depth_entry = self.max_depth_entry = gtk.SpinButton(
            gtk.Adjustment(value=max_depth_value, lower=1, upper=100,
            step_incr=1, page_incr=10), digits=0)
        max_depth_entry.get_adjustment().connect('value_changed',
            self._max_depth_changed, max_depth_entry)
        max_depth_entry.set_alignment(0)
        max_depth_label = gtk.Label()
        max_depth_label.set_alignment(1, 0.5)
        max_depth_label.set_text_with_mnemonic('Maximum _Depth')
        max_depth_label.set_mnemonic_widget(max_depth_entry)
        legend = self._create_legend()
        table = self.view = gtk.Table(2, 3)
        table.set_border_width(8)
        table.set_row_spacings(8)
        table.set_col_spacings(8)
        table.attach(max_depth_label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
        table.attach(max_depth_entry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL)
        table.attach(gtk.Label(), 2, 3, 0, 1)  # space filler
        table.attach(legend, 0, 3, 1, 2)
项目:wahcade    作者:sairuk    | 项目源码 | 文件源码
def __init__(self, WinMain):
        #set main window
        self.WinMain = WinMain
        #build the window
        self.winMessage = gtk.Fixed()
        self.winMessage.set_has_window(True)
        self.imgBackground = gtk.Image()
        self.lblHeading = gtk.Label()
        self.lblMessage = gtk.Label()
        self.lblPrompt = gtk.Label()
        self.lblHeading.set_justify(gtk.JUSTIFY_CENTER)
        self.lblMessage.set_justify(gtk.JUSTIFY_CENTER)
        self.lblPrompt.set_justify(gtk.JUSTIFY_CENTER)
        self.winMessage.add(self.imgBackground)
        self.winMessage.add(self.lblHeading)
        self.winMessage.add(self.lblMessage)
        self.winMessage.add(self.lblPrompt)
        WinMain.fixd.add(self.winMessage)
        self.imgBackground.show()
        self.lblHeading.show()
        self.lblMessage.show()
        self.lblPrompt.show()
        self.winMessage.show()
        #
        self.wait_for_key = False
项目:wahcade    作者:sairuk    | 项目源码 | 文件源码
def display_splash(self):
        """show splash screen"""
        self.splash = gtk.Window()
        self.splash.set_decorated(False)
        self.splash.set_transient_for(self.winMain)
        self.splash.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.splash.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self.splash.set_keep_above(True)
        self.splash.set_border_width(self.splash_border_width)
        vbox = gtk.VBox()
        img = gtk.Image()
        self.splash_gfx = os.path.join(CONFIG_DIR, 'layouts', self.layout, 'main-splash.png')
        if os.path.exists(self.splash_gfx):
            self.log_msg('Custom splash found, loading ' + str(self.splash_gfx))
            img.set_from_file(self.splash_gfx)
        else:
            self.splash_gfx = os.path.join(APP_PATH, 'pixmaps', 'wahcade-logo.png')
            self.log_msg('No custom splash found, loading ' + str(self.splash_gfx))
            img.set_from_file(self.splash_gfx)
        if self.splash_show_text == 1:
            lbl = gtk.Label()
            lbl.set_alignment(0.5, 0.5)
            lbl.set_justify(gtk.JUSTIFY_CENTER)
            lbl.set_use_markup(True)
            lbl.set_markup('<big><b>Wah!Cade</b></big>\n%s "%s"' % (VERSION, VERSION_NAME))
            vbox.pack_end(lbl)
        vbox.pack_start(img)
        self.splash.add(vbox)
        self.splash.show_all()
        if not self.tw_api:
            self.twitter_api = self.auth_twitter() ## Auth Twitter during startup
        self.wait_with_events(0.25)
项目:wahcade    作者:sairuk    | 项目源码 | 文件源码
def _create_list_labels(self):
        """create labels as rows"""
        #remove any existing rows
        [self.fixd.remove(row[0]) for row in self._rows]
        #create labels
        self._rows = []
        for i in range(self.num_rows):
            eb = gtk.EventBox()
            lbl = gtk.Label()
            lbl.modify_font(self._pango_font_desc)
            lbl.modify_fg(gtk.STATE_NORMAL, self._fg_col)
            lbl.modify_bg(gtk.STATE_NORMAL, self._hl_bg_col)
            lbl.set_property('xalign', self.properties['xalign'])
            lbl.set_angle(self.angle)
            lbl.show()
            eb.add(lbl)
            eb.add_events(gtk.gdk.BUTTON_PRESS_MASK)
            eb.connect('button-press-event', self._on_mouse_button, i)
            eb.show()
            eb.set_visible_window(False)
            self.fixd.add(eb)
            self._rows.append((eb, lbl))
        #colours
        self.modify_fg(gtk.STATE_NORMAL, self._fg_col)
        self.modify_highlight_bg(gtk.STATE_NORMAL, self._hl_bg_col)
项目:File-Explorer    作者:aj95    | 项目源码 | 文件源码
def __init__(self, parent):
        gtk.Dialog.__init__(self, "Rename", parent, 0)

        self.set_default_size(150, 100)
        label1=gtk.Label()
        label1.set_markup("Enter New Name")

        self.newname=gtk.Entry()
        box = self.get_content_area()
        box.add(label1)
        box.add(self.newname)

        self.ok_button=gtk.Button("OK")
        box.add(self.ok_button)
        self.ok_button.connect("clicked",self.on_rename_ok_clicked)
        self.show_all()
项目: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 _add(self, tab, row, name, editor, text, colindex=0):
        label = gtk.Label(text + ":")
        label.set_alignment(0.0, 0.5)
        label.show()
        tab.attach(label, colindex, colindex + 1, row, row + 1,
                   xoptions=gtk.FILL, yoptions=0, xpadding=6, ypadding=3)

        widget = editor.get_widget()
        widget.show()
        tab.attach(widget, colindex + 1, colindex + 2, row, row + 1,
                   xoptions=gtk.FILL, yoptions=0, xpadding=3, ypadding=3)

        img = gtk.Image()
        img.set_size_request(16, -1)
        img.show()
        tab.attach(img, colindex + 2, colindex + 3, row, row + 1,
                   xoptions=gtk.FILL, yoptions=0, xpadding=3, ypadding=3)

        self._editors[name] = label, editor, img
        return label, editor, img
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def _build_ui(self):
        self._entries = []
        self._update = True

        hexdigits = ((self._element.size() / 4) +
                     (self._element.size() % 4 and 1 or 0))
        formats = [('Hex', 16, '0x{:0%iX}' % hexdigits),
                   ('Dec', 10, '{:d}'),
                   ('Bin', 2, '{:0%ib}' % self._element.size())]
        for name, base, format_spec in formats:
            lab = gtk.Label(name)
            self.pack_start(lab, 0, 0, 0)
            lab.show()
            int(self._element)
            ent = IntegerEntry()
            self._entries.append((ent, format_spec))
            ent.connect('changed', self._changed, base)
            self.pack_start(ent, 0, 0, 0)
            ent.show()
        self._update_entries()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def _build_ui(self):
        lab = gtk.Label("Dec")
        lab.show()
        self.pack_start(lab, 0, 0, 0)
        ent = FixedEntry()
        ent.set_text(str(int(self._element)))
        ent.show()
        self.pack_start(ent, 1, 1, 1)

        lab = gtk.Label("Hex")
        lab.show()
        self.pack_start(lab, 0, 0, 0)

        hexent = FixedEntry()
        hexent.show()
        self.pack_start(hexent, 1, 1, 1)
        hexent.set_editable(False)

        ent.connect('changed', self._changed, hexent)
        self._format_hexent(hexent)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, title, parent=None):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_modal(True)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self.set_title(title)
        if parent:
            self.set_transient_for(parent)

        self.set_resizable(False)

        vbox = gtk.VBox(False, 2)

        self.label = gtk.Label("")
        self.label.set_size_request(100, 50)
        self.label.show()

        self.pbar = gtk.ProgressBar()
        self.pbar.show()

        vbox.pack_start(self.label, 0, 0, 0)
        vbox.pack_start(self.pbar, 0, 0, 0)

        vbox.show()

        self.add(vbox)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, msg, parent=None):
        gtk.Window.__init__(self)
        self.set_title("Please Wait")
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        if parent:
            self.set_transient_for(parent)
            self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        else:
            self.set_position(gtk.WIN_POS_CENTER)

        vbox = gtk.VBox(False, 2)

        l = gtk.Label(msg)
        l.show()
        vbox.pack_start(l)

        self.prog = gtk.ProgressBar()
        self.prog.show()
        vbox.pack_start(self.prog)

        vbox.show()
        self.add(vbox)
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, rthread, parent=None):
        gtk.Dialog.__init__(self,
                            title=_("Shift"),
                            buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_OK))

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.rthread = rthread

        self.__prog = gtk.ProgressBar()
        self.__prog.show()

        self.__labl = gtk.Label("")
        self.__labl.show()

        self.vbox.pack_start(self.__prog, 1, 1, 1)
        self.vbox.pack_start(self.__labl, 0, 0, 0)

        self.quiet = False

        self.thread = None
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, **args):
        buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                   gtk.STOCK_OK, gtk.RESPONSE_OK)
        gtk.Dialog.__init__(self, buttons=buttons, **args)

        self.label = gtk.Label()
        self.label.set_size_request(300, 100)
        # pylint: disable-msg=E1101
        self.vbox.pack_start(self.label, 1, 1, 0)

        self.text = gtk.Entry()
        self.text.connect("activate", self.respond_ok, None)
        # pylint: disable-msg=E1101
        self.vbox.pack_start(self.text, 1, 1, 0)

        self.label.show()
        self.text.show()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, choices, **args):
        buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                   gtk.STOCK_OK, gtk.RESPONSE_OK)
        gtk.Dialog.__init__(self, buttons=buttons, **args)

        self.label = gtk.Label()
        self.label.set_size_request(300, 100)
        # pylint: disable-msg=E1101
        self.vbox.pack_start(self.label, 1, 1, 0)
        self.label.show()

        try:
            default = choices[0]
        except IndexError:
            default = None

        self.choice = make_choice(sorted(choices), self.editable, default)
        # pylint: disable-msg=E1101
        self.vbox.pack_start(self.choice, 1, 1, 0)
        self.choice.show()

        self.set_default_response(gtk.RESPONSE_OK)
项目: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
项目:id_photo    作者:aeifn    | 项目源码 | 文件源码
def delete_format(self, widget, data=None):
    # ???? ???????? gtk.RadioButton
    for format_id in self.format_radio:
      if format_id.get_active():
        # ?????????? ??????, ? ??????? ???????? ???????????? ?????????? ???? ?????
        dialog = gtk.Dialog('???????? ??????? "' + self.data['formats'][self.format_radio.index(format_id)]['name'] + '"', self.window, gtk.DIALOG_NO_SEPARATOR | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_NO, gtk.RESPONSE_CANCEL, gtk.STOCK_YES, gtk.RESPONSE_OK))
        dialog.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        dialog.set_resizable(False)
        dialog.set_border_width(10)
        self.confirmation_label = gtk.Label('?? ????????????? ?????? ??????? ?????? "' + self.data['formats'][self.format_radio.index(format_id)]['name'] + '"?')
        dialog.vbox.pack_start(self.confirmation_label, True, True, 5)
        dialog.show_all()
        response = dialog.run()
        if response == gtk.RESPONSE_CANCEL:
          dialog.hide()
          dialog.destroy()
        if response == gtk.RESPONSE_OK:
          # ??????? ??????
          name = self.data['formats'][self.format_radio.index(format_id)]['name']
          del self.data['formats'][self.format_radio.index(format_id)]
          config = open(self.path, 'wb')
          json.dump(self.data, config)
          config.close()
          self.format_radio[self.format_radio.index(format_id)].hide()
          if len(self.format_radio) == 1:
            pass
          elif self.format_radio.index(format_id) + 1 <= len(self.format_radio) - 1:
            self.format_radio[self.format_radio.index(format_id) + 1].set_active(True)
          elif self.format_radio.index(format_id) + 1 > len(self.format_radio) - 1:
            self.format_radio[self.format_radio.index(format_id) - 1].set_active(True)
          del self.format_radio[self.format_radio.index(format_id)]
          if len(self.format_radio) < 1:
            self.delete_button.set_sensitive(False)
            self.edit_button.set_sensitive(False)
          self.add_success_label.set_markup('<span foreground="#008600">"' + str(name) + '" ??????? ??????\n</span>')
          dialog.hide()
          dialog.destroy()
        break

  # ??? ??????? ???????????? ?????????? ?????? ???????
项目: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 _setup_table(self):
        """Called by __init__ to set up my main table.

        You can easily override me instead of clobbering __init__.
        """

        table = gtk.Table(len(self.propertyLabels), 2)
        self.container.add(table)
        table.set_name("PropertyTable")
        self.subtable['properties'] = table
        row = 0

        for p, name in self.propertyLabels:
            label = gtk.Label(name)
            label.set_name("PropertyName")
            label.set_data("property", p)
            table.attach(label, 0, 1, row, row + 1)
            label.set_alignment(0, 0)
            row = row + 1

        # XXX: make these guys collapsable
        for g, name in self.groupLabels:
            table = gtk.Table(1, 2)
            self.container.add(table)
            table.set_name("AttributeGroupTable")
            self.subtable[g] = table
            label = gtk.Label(name)
            label.set_name("AttributeGroupTitle")
            table.attach(label, 0, 2, 0, 1)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def fill_property(self, property, value):
        """Set a value for a particular property.

        'property' should be one of the keys in my propertyLabels.
        """
        row, name = self.propertyLabels.get(property)
        if type(value) is not types.InstanceType:
            widget = gtk.Label(str(value))
            widget.set_alignment(0, 0)
        else:
            widget = value.newAttributeWidget(self)
        widget.set_name("PropertyValue")

        self.subtable['properties'].attach(widget, 1, 2, row, row+1)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def fill_attributeGroup(self, group, attributes):
        """Provide members of an attribute group.

        'group' should be one of the keys in my groupLabels, and
        'attributes' a list of (name, value) pairs, with each value as
        either an Explorer or string.
        """

        # XXX: How to indicate detail level of members?

        table = self.subtable[group]
        if not attributes:
            table.hide()
            return

        table.resize(len(attributes)+1, 2)

        # XXX: Do I need to destroy previously attached children?

        row = 1 # 0 is title

        for name, value in attributes.items():
            label = gtk.Label(name)
            label.set_name("AttributeName")
            label.set_alignment(0, 0)

            if type(value) is types.StringType:
                widget = gtk.Label(value)
                widget.set_alignment(0, 0)
            else:
                widget = value.newAttributeWidget(self)

            table.attach(label, 0, 1, row, row + 1)
            table.attach(widget, 1, 2, row, row + 1)
            row = row + 1

        table.show_all()
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def getTextForLabel(self):
        """Returns text for my label.

        The default implementation of AttributeWidget is a gtk.Label
        widget.  You may override this method to change the text which
        appears in the label.  However, if you don't want to be a
        label, override _makeWidgetObject instead.
        """
        return self.identifier
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def _makeWidgetObject(self):
        """Make the GTK widget object that is me.

        Called by __init__ to construct the GtkObject I wrap-- the ._o
        member of a pygtk GtkObject.  Isn't subclassing GtkObjects in
        Python fun?
        """
        ebox = gtk.EventBox()
        label = gtk.Label(self.getTextForLabel())
        label.set_alignment(0,0)
        ebox.add(label)
        return ebox._o
项目:ns3-rdma    作者:bobzhuyb    | 项目源码 | 文件源码
def __init__(self, title=None):
        self.__title_text = None
        gtk.widget_push_composite_child()
        self.__title = gobject.new(gtk.Label, visible=True, xalign=0, yalign=0.5)
        self.__indent = gobject.new(gtk.Label, visible=True, label='    ')
        gtk.widget_pop_composite_child()
        gtk.Bin.__init__(self)
        self.__title.set_parent(self)
        self.__indent.set_parent(self)
        if title is not None:
            self.props.title = title
项目:ns3-rdma    作者:bobzhuyb    | 项目源码 | 文件源码
def __init__(self):
        assert Visualizer.INSTANCE is None
        Visualizer.INSTANCE = self
        super(Visualizer, self).__init__()
        self.nodes =  {} # node index -> Node
        self.channels = {} # id(ns3.Channel) -> Channel
        self.window = None # toplevel window
        self.canvas = None # goocanvas.Canvas
        self.time_label = None # gtk.Label
        self.play_button = None # gtk.ToggleButton
        self.zoom = None # gtk.Adjustment
        self._scrolled_window = None # gtk.ScrolledWindow

        self.links_group = goocanvas.Group()
        self.channels_group = goocanvas.Group()
        self.nodes_group = goocanvas.Group()

        self._update_timeout_id = None
        self.simulation = SimulationThread(self)
        self.selected_node = None # node currently selected
        self.speed = 1.0
        self.information_windows = []
        self._transmission_arrows = []
        self._last_transmissions = []
        self._drop_arrows = []
        self._last_drops = []
        self._show_transmissions_mode = None
        self.set_show_transmissions_mode(ShowTransmissionsMode.ALL)
        self._panning_state = None
        self.node_size_adjustment = None
        self.transmissions_smoothing_adjustment = None
        self.sample_period = SAMPLE_PERIOD
        self.node_drag_state = None
        self.follow_node = None
        self.shell_window = None

        self.create_gui()

        for plugin in plugins:
            plugin(self)
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_collector_bbox(self, collector):
        frame = gtk.Frame(collector.name)

        if collector.is_enabled():
            layout = gtk.BUTTONBOX_SPREAD
            spacing = 10

            bbox = gtk.HButtonBox()
            bbox.set_border_width(1)
            bbox.set_layout(layout)
            bbox.set_spacing(spacing)
            frame.add(bbox)

            startCollectorButton = gtk.Button('Start Collector')
            startCollectorButton.connect("clicked", self.startIndividualCollector, collector)
            startCollectorButton.set_sensitive(not isinstance(collector, engine.collector.ManualCollector))
            bbox.add(startCollectorButton)

            stopCollectorButton = gtk.Button('Stop Collector')
            stopCollectorButton.connect("clicked", self.stopIndividualCollector, collector)
            stopCollectorButton.set_sensitive(not isinstance(collector, engine.collector.ManualCollector))
            bbox.add(stopCollectorButton)

            parseButton = gtk.Button('Parse Data')
            parseButton.connect("clicked", self.parser, collector)
            bbox.add(parseButton)
        else:
            label = gtk.Label("Collector Disabled")
            frame.add(label)

        return frame
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def create_error_vbox(self, error_msg):
        vbox_error = gtk.VBox()

        traceback.print_exc()
        err_label = gtk.Label(error_msg)
        err_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red"))
        vbox_error.pack_start(err_label)

        return vbox_error
项目: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
项目:zim-icontags-plugin    作者:Pl-M    | 项目源码 | 文件源码
def __call__(self, icon):
        try:
            return self.cache[icon]
        except KeyError: # element not in cache
            result = gtk.Label().render_icon(icon, self.size)
            self.cache[icon] = result
            return result
项目:zim-icontags-plugin    作者:Pl-M    | 项目源码 | 文件源码
def __call__(self, icon):
        try:
            return self.cache[icon]
        except KeyError: # element not in cache
            result = gtk.Label().render_icon(icon, self.size)
            self.cache[icon] = result
            return result
项目:srcsim2017    作者:ZarjRobotics    | 项目源码 | 文件源码
def exitfc_button_cb(self, button):
        label = gtk.Label("Are you sure you want the FC to exit?")
        dialog = gtk.Dialog("Confirm Exit",
                       None,
                       gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                       (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                       gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        dialog.vbox.pack_start(label)
        label.show()
        response = dialog.run()
        dialog.destroy()

        if response == gtk.RESPONSE_ACCEPT:
            msg = ZarjExitCommand()
            self.zarj_comm.push_message(msg)
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def __init__(self, label="", ellipsize=pango.ELLIPSIZE_END):
        gtk.Label.__init__(self)
        self.set_use_markup(True)
        self.set_justify(gtk.JUSTIFY_LEFT)
        self.set_alignment(xalign=0.0, yalign=0.5)
        self.set_markup(label)
        if ellipsize:
            self.set_ellipsize(ellipsize)
    # __init__()
# Label
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def __init__(self, label=""):
        Label.__init__(self, label)
        self.set_line_wrap(True)
        self.set_single_line_mode(False)
        self.set_justify(gtk.JUSTIFY_FILL)
    # __init__()
# MultiLineLabel
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def new_label_for(label, field, align_right=True):
    """Creates a new gtk.Label and associates it to field"""
    wid = gtk.Label(label)
    wid.set_mnemonic_widget(field)
    if align_right:
        wid.set_justify(gtk.JUSTIFY_RIGHT)
        wid.set_alignment(xalign=1.0, yalign=0.5)
    return wid
# new_label_for()
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def new_table(wids):
    """Creates a gtk.Table with two rows, use it for forms"""
    p = gtk.Table(rows=len(wids) or 1, columns=2, homogeneous=False)
    p.set_col_spacings(5)
    p.set_row_spacings(5)
    if len(wids) < 1:
        wid = gtk.Label("Empty")
        p.attach(wid, 0, 2, 0, 1)
        p.show_all()
        return p

    for i, row in enumerate(wids):
        if isinstance(row, basestring):
            wid = Label("<b>%s</b>" % row)
            p.attach(wid, 0, 2, i, i+1)
            wid.show()
            if i > 0:
                p.set_row_spacing(i-1, 10)

        elif isinstance(row, (tuple, list)):
            label, field = row
            wid = new_label_for(label, field)
            p.attach(wid, 0, 1, i, i+1, xoptions=gtk.FILL)
            p.attach(field, 1, 2, i, i+1)
            wid.show()
            field.show()

    sw = gtk.ScrolledWindow()
    sw.set_shadow_type(gtk.SHADOW_NONE)
    sw.set_policy(hscrollbar_policy=gtk.POLICY_NEVER,
                  vscrollbar_policy=gtk.POLICY_AUTOMATIC)
    sw.add_with_viewport(p)
    p.show()
    sw.show()
    return sw
# new_table()
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def setup_gui_button_contents(self):
        self.gui_button_contents = gtk.Label(self.__class__.__name__)
        self.gui_button_contents.show()
    # setup_gui_button_contents()
项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def _setup_ui_advanced(self):
        self.width = hildon.NumberEditor(100, 400)
        self.height = hildon.NumberEditor(100, 240)

        wids = ("Media",
                ("Width:", self.width),
                ("Height:", self.height),
                )

        self.tab.append_page(catota.ui.new_table(wids), gtk.Label("Advanced"))
    # _setup_ui_advanced()