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


Python Gtk.Window方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.win.add(box)

        label = Gtk.Label(title)
        label.set_padding(10, 10)
        label.get_style_context().add_class("KanoProgressBar")
        box.pack_start(label, False, False, 5)
        box.pack_start(self, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:24,代码来源:kano_progress.py

示例2: on_folder_clicked

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def on_folder_clicked(self):
        Gtk.Window.__init__(self, title=_("Change working directory"))
        dialog = Gtk.FileChooserDialog(_("Choose directory"),
                                       self,
                                       Gtk.FileChooserAction.SELECT_FOLDER,
                                       (Gtk.STOCK_CANCEL,
                                        Gtk.ResponseType.CANCEL,
                                        _("Apply"),
                                        Gtk.ResponseType.OK,
                                        )
                                       )
        dialog.set_default_size(800, 400)
        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            self.selectedfolder = dialog.get_filename()
        elif response == Gtk.ResponseType.CANCEL:
            self.selectedfolder = cli.stdir

        dialog.destroy() 
开发者ID:encarsia,项目名称:gpt,代码行数:21,代码来源:modules.py

示例3: show_dialog_exc_socket_error

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def show_dialog_exc_socket_error(error, parent, title=None):
	"""
	Display an error dialog with details regarding a :py:exc:`socket.error`
	exception that has been raised.

	:param error: The exception instance that has been raised.
	:type error: :py:exc:`socket.error`
	:param parent: The parent window that the dialog should belong to.
	:type parent: :py:class:`Gtk.Window`
	:param title: The title of the error dialog that is displayed.
	"""
	title = title or 'Connection Error'
	if isinstance(error, socket.timeout):
		description = 'The connection to the server timed out.'
	elif len(error.args) > 1:
		error_number, error_message = error.args[:2]
		if error_number == 111:
			description = 'The server refused the connection.'
		else:
			description = "Socket error #{0} ({1}).".format((error_number or 'N/A'), error_message)
	return show_dialog(Gtk.MessageType.ERROR, title, parent, secondary_text=description) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:23,代码来源:gui_utilities.py

示例4: make_window

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def make_window(self):
		"""
		Create a window from the figure manager.

		:return: The graph in a new, dedicated window.
		:rtype: :py:class:`Gtk.Window`
		"""
		if self.manager is None:
			self.manager = FigureManager(self.canvas, 0)
		self.navigation_toolbar.destroy()
		self.navigation_toolbar = self.manager.toolbar
		self._menu_item_show_toolbar.set_active(True)
		window = self.manager.window
		window.set_transient_for(self.application.get_active_window())
		window.set_title(self.graph_title)
		return window 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:18,代码来源:graphs.py

示例5: error_msg_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def error_msg_gtk(msg, parent=None):
    if parent is not None: # find the toplevel Gtk.Window
        parent = parent.get_toplevel()
        if not parent.is_toplevel():
            parent = None

    if not is_string_like(msg):
        msg = ','.join(map(str,msg))

    dialog = Gtk.MessageDialog(
        parent         = parent,
        type           = Gtk.MessageType.ERROR,
        buttons        = Gtk.ButtonsType.OK,
        message_format = msg)
    dialog.run()
    dialog.destroy() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:backend_gtk3.py

示例6: error_msg_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def error_msg_gtk(msg, parent=None):
    if parent is not None:  # find the toplevel Gtk.Window
        parent = parent.get_toplevel()
        if not parent.is_toplevel():
            parent = None

    if not isinstance(msg, str):
        msg = ','.join(map(str, msg))

    dialog = Gtk.MessageDialog(
        parent         = parent,
        type           = Gtk.MessageType.ERROR,
        buttons        = Gtk.ButtonsType.OK,
        message_format = msg)
    dialog.run()
    dialog.destroy() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:backend_gtk3.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        self.user = user
        self.label = _('Download media')
        ManagedWindow.__init__(self, uistate, [], self.__class__)
        self.set_window(Gtk.Window(), Gtk.Label(), '')
        tool.Tool.__init__(self, dbstate, options_class, name)

        self.num_downloads = 0
        dialog = self.display()
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.ACCEPT:
            self.on_ok_clicked()
            if hasattr(self.user.uistate, 'window'):
                parent_window = self.user.uistate.window
            else:
                parent_window = None
            OkDialog(_('Media downloaded'),
                     _("%d media files downloaded") % self.num_downloads,
                     parent=parent_window)
        self.close() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:25,代码来源:DownloadMedia.py

示例8: thumbnail_view

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def thumbnail_view(self, _object):
        """
        will allow a display area for a thumbnail pop-up window.
        """
        tip = _("Click Close to close this Thumbnail View Area.")

        parent = self.gui.get_container_widget().get_toplevel()
        self.tbarea = Gtk.Window(type=Gtk.WindowType.TOPLEVEL,
                                 transient_for=parent)
        self.tbarea.tooltip = tip
        self.tbarea.set_title(_("Thumbnail View Area"))

        pbloader, width, height = self.__get_thumbnail_data()
        if pbloader:
            self.tbarea.set_default_size((width + 40), (height + 40))

            self.tbarea.set_border_width(10)
            self.tbarea.connect('destroy', lambda w: self.tbarea.destroy())

            new_vbox = self.build_thumbnail_gui(pbloader, width, height)
            self.tbarea.add(new_vbox)
            self.tbarea.show()
        else:
            self.deactivate_buttons(["Thumbnail"])
            lambda w: self.tbarea.destroy() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:27,代码来源:editexifmetadata.py

示例9: insert_table

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def insert_table(self, widget):
        self.insert_window_table = Gtk.Window()
        self.insert_window_table.set_title("Insert Table")
        self.insert_window_table.set_resizable(True)
        self.insert_window_table.set_border_width(6)
        self.insert_window_table.set_default_size(300, 250)
        self.insert_window_table.set_position(Gtk.WindowPosition.CENTER)
        vbox = Gtk.VBox()
        label_n_rows = Gtk.Label("Number of Rows:")
        self.entry_n_rows = Gtk.Entry()
        label_n_columns = Gtk.Label("Number of Columns")
        self.entry_n_columns = Gtk.Entry()
        vbox.pack_start(label_n_rows, self, False, False)
        vbox.pack_start(self.entry_n_rows, self, False, False)
        vbox.pack_start(label_n_columns, self, False, False)
        vbox.pack_start(self.entry_n_columns, self, False, False)
        button = Gtk.Button("Insert Table")
        vbox.pack_end(button, self, False, False)
        self.insert_window_table.add(vbox)
        self.insert_window_table.show_all()
        button.connect("clicked", self.insert_table_cmd, self.insert_window_table) 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:23,代码来源:RemarkableWindow.py

示例10: on_menuitem_custom_activate

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def on_menuitem_custom_activate(self, widget):
        self.custom_window = Gtk.Window()
        self.custom_window.set_default_size(640, 480)
        self.custom_window.set_position(Gtk.WindowPosition.CENTER)
        self.custom_window.set_title("Custom CSS")

        self.custom_vbox = Gtk.VBox()
        self.custom_scroller = Gtk.ScrolledWindow()
        self.custom_button = Gtk.Button("Apply")
        self.custom_vbox.pack_end(self.custom_button, False, False, 0)
        self.custom_text_view = Gtk.TextView()
        self.custom_text_buffer = Gtk.TextBuffer()
        self.custom_text_buffer.set_text(self.custom_css)
        self.custom_text_view.set_buffer(self.custom_text_buffer)
        self.custom_scroller.add(self.custom_text_view)
        self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
        self.custom_window.add(self.custom_vbox)
        self.custom_window.show_all()
        self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer) 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:21,代码来源:RemarkableWindow.py

示例11: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def __init__(self, folders):
        GObject.GObject.__init__(self)
        Thread.__init__(self)
        Gtk.Window.__init__(self)
        self.connect("delete-event", self._close_window)
        # Here i assume that all folders got the same icon...
        self._folders = folders
        self.model = []
        self._flowbox = Gtk.FlowBox()

        # Threading stuff
        self.setDaemon(True)
        self.run()

        # Window configurations
        self.set_default_size(650, 500)
        self.set_size_request(650, 500)
        self.set_resizable(True)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.connect("key-press-event", self._on_key_press)

        # Widgets & Accelerators
        self._build_header_bar()
        self._build_content()
        self._setup_accels() 
开发者ID:bilelmoussaoui,项目名称:nautilus-folder-icons,代码行数:27,代码来源:widgets.py

示例12: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def __init__(self, volctl):
        self.volctl = volctl
        self._win = Gtk.Window(type=Gtk.WindowType.POPUP)
        self._win.connect("enter-notify-event", self._cb_enter_notify)
        self._win.connect("leave-notify-event", self._cb_leave_notify)
        self._grid = Gtk.Grid()
        self._grid.set_column_spacing(2)
        self._grid.set_row_spacing(self.SPACING)
        self._frame = Gtk.Frame()
        self._frame.set_shadow_type(Gtk.ShadowType.OUT)
        self._frame.add(self._grid)
        self._win.add(self._frame)

        # gui objects by index
        self._sink_scales = {}
        self._sink_input_scales = {}

        self._create_sliders()
        self._win.show_all()
        self._set_position()

        # timeout
        self._timeout = None
        self._enable_timeout() 
开发者ID:buzz,项目名称:volctl,代码行数:26,代码来源:slider_win.py

示例13: store_widget_properties

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def store_widget_properties(self, widget, widget_name):
        """Sets configuration values for widgets

        If the widget is a window, then the size and position are stored. If the widget is a pane, then only the
        position is stored. If the window is maximized the last insert position before being maximized is keep in the
        config and the maximized flag set to True. The maximized state and the last size and position are strictly
        separated by this.

        :param widget: The widget, for which the position (and possibly the size) will be stored.
        :param widget_name: The window or widget name of the widget, which constitutes a part of its key in the
        configuration file.
        """
        if isinstance(widget, Gtk.Window):
            maximized = bool(widget.is_maximized())
            self.set_config_value('{0}_MAXIMIZED'.format(widget_name), maximized)
            if maximized:
                return
            size = widget.get_size()
            self.set_config_value('{0}_SIZE'.format(widget_name), tuple(size))
            position = widget.get_position()
            self.set_config_value('{0}_POS'.format(widget_name), tuple(position))
        else:  # Gtk.Paned
            position = widget.get_position()
            self.set_config_value('{0}_POS'.format(widget_name), position) 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:26,代码来源:runtime_config.py

示例14: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def __init__(self, view_class, width=500, height=500, title=None, pos=None):
        View.__init__(self)

        w = Gtk.Window()
        if title is None:
            w.set_title(str(view_class))
        else:
            w.set_title(title)
        w.resize(width=width, height=height)
        if pos is not None:
            w.set_position(pos)
        self.widget_view = view_class()
        w.add(self.widget_view.get_top_widget())
        w.show_all()

        self['main_frame'] = self.widget_view
        self.top = 'main_frame'
        self['main_window'] = w 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:20,代码来源:single_widget_window.py

示例15: _init_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Window [as 别名]
def _init_widgets(self):
        """Create all the other widgets and add them to the class."""
        self["eventhandler"] = EventHandler(self)
        self["transform"] = Transform(self)
        self["commandline"] = CommandLine(self)
        self["tags"] = TagHandler(self)
        self["mark"] = Mark(self)
        self["clipboard"] = ClipboardHandler(self)
        self["statusbar"] = Statusbar(self)
        self["completions"] = Completion(self)
        self["slideshow"] = Slideshow(self)
        self["main_window"] = MainWindow(self)
        self["image"] = self["main_window"].image
        self["thumbnail"] = self["main_window"].thumbnail
        self["library"] = Library(self)
        self["manipulate"] = Manipulate(self)
        self["information"] = Information()
        self["window"] = Window(self)
        # Generate completions as soon as commands exist
        self["commandline"].init_commands()
        self["completions"].generate_commandlist()
        self["log"] = Log(self) 
开发者ID:karlch,项目名称:vimiv,代码行数:24,代码来源:app.py


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