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


Python Gtk.Builder方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, parent):
        builder = Gtk.Builder()
        builder.add_from_file(locate_resource('client_information.ui'))
        builder.connect_signals(self)
        self.dialog = builder.get_object('dlg_client_information')
        self.dialog.set_transient_for(parent)
        self.btn_edit_alias = builder.get_object('btn_edit_alias')
        self.dlg_edit_alias = builder.get_object('dlg_edit_alias')
        self.ent_alias = builder.get_object('ent_alias')
        self.lbl_type = builder.get_object('lbl_type')
        self.lbl_alias = builder.get_object('lbl_alias')
        self.lbl_hostname = builder.get_object('lbl_hostname')
        self.lbl_mac = builder.get_object('lbl_mac')
        self.lbl_ip = builder.get_object('lbl_ip')
        self.lbl_user = builder.get_object('lbl_user')
        self.lbl_cpu = builder.get_object('lbl_cpu')
        self.lbl_ram = builder.get_object('lbl_ram')
        self.lbl_vga = builder.get_object('lbl_vga')
        self.client = None 
开发者ID:epoptes,项目名称:epoptes,代码行数:21,代码来源:client_information.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, ip, port, number):

        builder = Gtk.Builder()
        builder.add_from_file(os.getcwd()+"/share/ui/sms.glade")
        builder.connect_signals(self)
        self.window = builder.get_object("smswindow")
        self.numberentry = builder.get_object("numberentry")
        self.messagetextview = builder.get_object("messagetextview")
        self.charlabel = builder.get_object("charcountlabel")
        self.errordialog = builder.get_object("errordialog")

        self.window.set_wmclass ("DeskCon", "Compose")

        self.ip = ip
        self.port = port

        self.numberentry.set_text(number)
        self.textbuffer = self.messagetextview.get_buffer()
        self.window.show_all() 
开发者ID:screenfreeze,项目名称:deskcon-desktop,代码行数:21,代码来源:sms.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, app):
    self.app    = app
    self.stack  = app.channels_stack
    self.filter = None

    self.channels = Gtk.Builder()
    self.channels.add_from_file(relative_path('ui/channels.ui'))
    self.channels.connect_signals(self)

    self.channels_box = self.channels.get_object('box_channels')
    self.stack.add_named(self.channels_box, 'channels_container')

    self.channels_filters = self.channels.get_object('list_box_channels_filters')
    self.channels_list    = self.channels.get_object('flow_box_channels_list')
    self.channels_list.set_filter_func(self.on_channels_list_row_changed)

    GLib.idle_add(self.do_initial_setup) 
开发者ID:jonian,项目名称:kickoff-player,代码行数:19,代码来源:channel.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, req, app):
        self.req = req
        self.config = self.req.get_config('browser')
        builder = Gtk.Builder()
        builder.add_from_file(self.GENERAL_PREFERENCES_UI)

        self.ui_widget = builder.get_object("general_pref_window")
        self.preview_button = builder.get_object("preview_button")
        self.bg_color_button = builder.get_object("bg_color_button")
        self.font_button = builder.get_object("font_button")

        self.app = app
        self.timer = app.timer
        self.refresh_time = builder.get_object("time_entry")
        self.autoclean_enable = builder.get_object("autoclean_enable")
        self.autoclean_days = builder.get_object("autoclean_days")

        builder.connect_signals(self)

    # Following 3 methods: get_name, get_title, get_ui are
    # required for all children of stack in Preferences class.
    # Plugins and Synchronisation must have them, too!
    # They are used for easier, more abstract adding of the
    # children and setting the headerbar title. 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:26,代码来源:general_preferences.py

示例5: _load_widgets_from_builder

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def _load_widgets_from_builder(self, builder):
        """
        Loads widgets from the builder .ui file

        @param builder: a Gtk.Builder
        """
        builder.add_from_file(ViewConfig.BACKENDS_UI_FILE)
        widgets = {
            'dialog': 'backends',
            'treeview_window': 'treeview_window',
            'central_pane': 'central_pane',
            'add_button': 'add_button',
            'remove_button': 'remove_button',
        }
        for attr, widget in widgets.items():
            setattr(self, attr, builder.get_object(widget)) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:18,代码来源:__init__.py

示例6: preference_dialog_init

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def preference_dialog_init(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file(os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            "notification_area.ui"))
        self.preferences_dialog = self.builder.get_object("preferences_dialog")
        self.chbox_minimized = self.builder.get_object("pref_chbox_minimized")
        self.spinbutton_dangerzone = \
            self.builder.get_object("pref_spinbutton_dangerzone")
        SIGNAL_CONNECTIONS_DIC = {
            "on_preferences_dialog_delete_event":
            self.on_preferences_cancel,
            "on_btn_preferences_cancel_clicked":
            self.on_preferences_cancel,
            "on_btn_preferences_ok_clicked":
            self.on_preferences_ok,
        }
        self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:20,代码来源:notification_area.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, main_window):
        """
        Initializes the AboutDialog.

        Loads the Gtk.Builder and parses the Glade file. Then the signals, that
        are declared in the Glade file are connected to this class.
        """
        self.builder = Gtk.Builder()
        self.builder.set_translation_domain(i18n().get_ts_domain())
        script_dir = os.path.dirname(__file__)
        rel_path = "gui_layout.glade"
        abs_path = os.path.join(script_dir, rel_path)
        self.builder.add_objects_from_file(abs_path,
            ("aboutdialog", ""))
        self.ab = self.builder.get_object("aboutdialog")
        self.ab.set_transient_for(main_window)
        self.builder.connect_signals(self)
        if sys.platform == "win32":
            translate_gui(self.builder) 
开发者ID:innstereo,项目名称:innstereo,代码行数:21,代码来源:dialog_windows.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def __init__(self, filename):
        # TODO: remove this when upstream fixes translations with Python3+Windows
        if sys.platform == "win32" and not conf.no_gettext:
            tree = ET.parse(addDataPrefix("glade/%s" % filename))
            for node in tree.iter():
                if 'translatable' in node.attrib:
                    node.text = _(node.text)
                    del node.attrib['translatable']
                if node.get('name') in ('pixbuf', 'logo'):
                    node.text = addDataPrefix("glade/%s" % node.text)
            xml_text = ET.tostring(tree.getroot(), encoding='unicode', method='xml')
            self.builder = Gtk.Builder.new_from_string(xml_text, -1)
        else:
            self.builder = Gtk.Builder()
            if not conf.no_gettext:
                self.builder.set_translation_domain("pychess")
            self.builder.add_from_file(addDataPrefix("glade/%s" % filename)) 
开发者ID:pychess,项目名称:pychess,代码行数:19,代码来源:uistuff.py

示例9: rename_note

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def rename_note(self, widget, note_selected):
		""" rename a note """

		builder = Gtk.Builder()
		builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../assets/ui/widgets.glade")

		self.rename_note_input = builder.get_object("rename-note-input")
		self.rename_note_win   = builder.get_object("rename-note")
		self.rename_note_save  = builder.get_object("rename-note-save")
		self.rename_note_canc  = builder.get_object("rename-note-canc")


		for idz in note_selected:
			self.rename_note_win.show()
			self.rename_note_win.set_title("rename note")

			self.rename_note_canc.connect('clicked', self._destroy_rename_note)
			self.rename_note_save.connect('clicked', self._save_rename_note, idz) 
开发者ID:r3vn,项目名称:badKarma,代码行数:20,代码来源:widgets.py

示例10: initialise

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def initialise(self, plugin):
        super(AltToolbarCompact, self).initialise(plugin)

        self._setup_compactbar()

        if self.shell.props.application.get_menubar() == None:
            builder = Gtk.Builder()
            ui = rb.find_plugin_file(self.plugin, 'ui/altmenubar.ui')
            cl = CoverLocale()
            builder.set_translation_domain(cl.Locale.RB)
            builder.add_from_file(ui)
            menubar = builder.get_object("menubar")
            self.shell.props.application.link_shared_menus(menubar)
            self.shell.props.application.set_menubar(menubar)

            self.load_builder_content(builder) 
开发者ID:fossfreedom,项目名称:alternative-toolbar,代码行数:18,代码来源:alttoolbar_type.py

示例11: load_from_file

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def load_from_file(self, rb2_ui_filename, rb3_ui_filename):
        """
        utility function to load the menu structure
        :param rb2_ui_filename: `str` RB2.98 and below UI file
        :param rb3_ui_filename: `str` RB2.99 and higher UI file
        """
        self.builder = Gtk.Builder()
        try:
            from coverart_browser_prefs import CoverLocale

            cl = CoverLocale()

            self.builder.set_translation_domain(cl.Locale.LOCALE_DOMAIN)
        except:
            pass

        if is_rb3(self.shell):
            ui_filename = rb3_ui_filename
        else:
            ui_filename = rb2_ui_filename

        self.ui_filename = ui_filename

        self.builder.add_from_file(rb.find_plugin_file(self.plugin,
                                                       ui_filename)) 
开发者ID:fossfreedom,项目名称:alternative-toolbar,代码行数:27,代码来源:alttoolbar_rb3compat.py

示例12: get_object

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def get_object(gtk_object):
	"""
	Used to maintain a diction of GTK objects to share through the SFTP Client

	:param str gtk_object: The name of the GTK Object to fetch
	:return: The requested gtk object
	"""
	global _builder
	if not _builder:
		_builder = Gtk.Builder()
	if not _gtk_objects:
		_builder.add_from_file(gtk_builder_file)
	if gtk_object in _gtk_objects:
		return _gtk_objects[gtk_object]
	else:
		_gtk_objects[gtk_object] = _builder.get_object(gtk_object)
		return _gtk_objects[gtk_object] 
开发者ID:rsmusllp,项目名称:king-phisher-plugins,代码行数:19,代码来源:sftp_utilities.py

示例13: initialize

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def initialize(self):
		self.window = None
		if not os.access(gtk_builder_file, os.R_OK):
			gui_utilities.show_dialog_error(
				'Plugin Error',
				self.application.get_active_window(),
				"The GTK Builder data file ({0}) is not available.".format(os.path.basename(gtk_builder_file))
			)
			return False
		self._label_summary = None
		self._rule_context = None
		self._tv = None
		self._tv_model = Gtk.ListStore(int, str, bool, str, str)
		self._tv_model.connect('row-inserted', self.signal_model_multi)
		self._tv_model.connect('row-deleted', self.signal_model_multi)
		self.menu_items = {}
		self.menu_items['edit_rules'] = self.add_menu_item('Tools  > Request Redirect Rules', self.show_editor_window)
		return True 
开发者ID:rsmusllp,项目名称:king-phisher-plugins,代码行数:20,代码来源:__init__.py

示例14: create_gtk_builder

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def create_gtk_builder(glade_file):
    """
    Create a Gtk builder and load the glade file.
    """
    builder = Gtk.Builder()
    builder.set_translation_domain('safeeyes')
    builder.add_from_file(glade_file)
    # Tranlslate all sub components
    for obj in builder.get_objects():
        if (not isinstance(obj, Gtk.SeparatorMenuItem)) and hasattr(obj, "get_label"):
            label = obj.get_label()
            if label is not None:
                obj.set_label(_(label))
        elif hasattr(obj, "get_title"):
            title = obj.get_title()
            if title is not None:
                obj.set_title(_(title))
    return builder 
开发者ID:slgobinath,项目名称:SafeEyes,代码行数:20,代码来源:utility.py

示例15: which_glade

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Builder [as 别名]
def which_glade():
	"""
	Locate the glade data file which stores the UI information in a Gtk Builder
	format.

	:return: The path to the glade data file.
	:rtype: str
	"""
	return find.data_file(os.environ.get('KING_PHISHER_GLADE_FILE', 'king-phisher-client.ui')) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:11,代码来源:gui_utilities.py


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