Python gi.repository.Gtk 模块,Window() 实例源码

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

项目:gnome-hud    作者:hardpixel    | 项目源码 | 文件源码
def gtk_theme_colors(self):
        window = Gtk.Window()
        style_context = window.get_style_context()
        gtk_theme_colors = {
            'bg': style_context.lookup_color('theme_bg_color')[1],
            'fg': style_context.lookup_color('theme_fg_color')[1],
            'selected_bg': style_context.lookup_color('theme_selected_bg_color')[1],
            'selected_fg': style_context.lookup_color('theme_selected_fg_color')[1],
            'error_bg': style_context.lookup_color('error_bg_color')[1],
            'error_fg': style_context.lookup_color('error_fg_color')[1],
            'info_bg': style_context.lookup_color('info_bg_color')[1],
            'unfocused_fg': style_context.lookup_color('theme_unfocused_fg_color')[1],
            'unfocused_bg': style_context.lookup_color('theme_unfocused_bg_color')[1]
        }

        for name, color in gtk_theme_colors.items():
            gtk_theme_colors[name] = self.rgba_to_hex(color)

        return gtk_theme_colors
项目:fpi    作者:solus-cold-storage    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)

        self.get_settings().set_property(
            "gtk-application-prefer-dark-theme", True)

        self.connect('destroy', lambda x: Gtk.main_quit())
        # Layout
        self.box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        self.add(self.box)

        self.abar = Gtk.ActionBar()
        self.box.pack_end(self.abar, False, False, 0)

        self.build_contents()

        # Finalize the window itself
        self.set_titlebar(self.headerbar())
        self.set_title("Foreign Package Installer")
        self.set_icon_name("system-software-install")
        self.set_size_request(600, 450)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.show_all()
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def generate_window(self, *args):
        """
            Generate application window (Gtk.Window)
        """
        Gtk.ApplicationWindow.__init__(self, type=Gtk.WindowType.TOPLEVEL,
                                       application=self.app)
        self.move_latest_position()
        self.set_wmclass("org.gnome.Authenticator", "Gnome Authenticator")
        self.set_icon_name("org.gnome.Authenticator")
        self.use_latest_size()
        self.set_resizable(True)
        self.connect("key_press_event", self.on_key_press)
        self.connect("delete-event", lambda x, y: self.app.on_quit())
        self.notification = InAppNotification()
        self.observable.register(self.notification)
        self.main_box.pack_start(self.notification, False, False, 0)
        self.add(self.main_box)
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def __init__(self, wmclass):
        Gtk.Window.__init__(self)
        OSDWindow._apply_css(Config())

        self.argparser = argparse.ArgumentParser(description=__doc__,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            epilog=self.EPILOG)
        self._add_arguments()
        self.exit_code = -1
        self.position = (20, -20)
        self.mainloop = None
        self._controller = None
        self.set_name(wmclass)
        self.set_wmclass(wmclass, wmclass)
        self.set_decorated(False)
        self.stick()
        self.set_skip_taskbar_hint(True)
        self.set_skip_pager_hint(True)
        self.set_keep_above(True)
        self.set_type_hint(Gdk.WindowTypeHint.NOTIFICATION)
项目:iutils    作者:inconvergent    | 项目源码 | 文件源码
def __init__(self, n, front, back, step):

    from gi.repository import Gtk
    from gi.repository import GObject

    Render.__init__(self, n, front, back)

    window = Gtk.Window()
    self.window = window
    window.resize(self.n, self.n)

    self.step = step

    window.connect("destroy", self.__destroy)
    darea = Gtk.DrawingArea()
    # darea.connect("expose-event", self.expose)
    self.darea = darea

    window.add(darea)
    window.show_all()

    #self.cr = self.darea.window.cairo_create()
    self.steps = 0
    GObject.idle_add(self.step_wrap)
项目:btcwidget    作者:rafalh    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, title="BTC Widget")

        self._ticker_labels = {}
        self._tickers_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self._create_ticker_labels()

        self._graph = btcwidget.graph.Graph(config['dark_theme'])

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.pack_start(self._tickers_vbox, False, False, 5)
        vbox.pack_start(self._graph, True, True, 0)

        self.set_icon_from_file(self._ICON_PATH)
        self.connect('delete-event', Gtk.main_quit)
        self.add(vbox)
        self.show_all()

        self._indicator = Indicator(self)

    # self.open_options()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Window.__init__(self)
        self.set_title(_("GNU Solfege lesson file editor") )
        self.set_default_size(400, 400)
        self.g_parent = parent
        self.vbox = Gtk.VBox()
        self.vbox.set_spacing(8)
        self.add(self.vbox)
        self.connect('delete_event', self.delete_cb)
        self.g_htmlwidget = htmlwidget.HtmlWidget(None, None)
        self.vbox.pack_start(self.g_htmlwidget, True, True, 0)
        self.vbox.pack_start(Gtk.HSeparator(), False)
        bbox = Gtk.HButtonBox()
        bbox.set_border_width(8)
        self.vbox.pack_start(bbox, False)
        b = Gtk.Button(stock=Gtk.STOCK_CLOSE)
        b.connect('clicked', self.close_cb)
        bbox.pack_start(b, True, True, 0)
        self.show_all()
        self.set_focus(b)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, datadir):
        Gtk.Window.__init__(self)
        self.icons = stock.EditorIconFactory(self, datadir)
        self.connect('destroy', lambda w: Gtk.main_quit())
        self.g_help_window = None
        # toplevel_vbox:
        #   -menubar
        #   -toolbar
        #   -notebook
        #   -statusbar
        self.toplevel_vbox = Gtk.VBox()
        self.add(self.toplevel_vbox)
        self.create_menu_and_toolbar()
        self.g_notebook = Gtk.Notebook()
        self.toplevel_vbox.pack_start(self.g_notebook, True, True, 0)
        self.vbox = Gtk.VBox()
        self.toplevel_vbox.pack_start(self.vbox, True, True, 0)
        self.create_mainwin_ui()
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)
        vbox = Gtk.VBox()
        self.add(vbox)
        self.set_default_size(600, 400)
        self.w = RhythmWidget()
        s = elems.Score()
        s.add_staff(staff_class=elems.RhythmStaff)
        s.add_bar(elems.TimeSignature(3, 4))
        s.add_bar(elems.TimeSignature(3, 4))
        s.voice11.fill_with_skips()
        self.w.set_score(s)
        vbox.pack_start(self.w, True, True, 0)
        #
        c = RhythmWidgetController(self.w)
        vbox.pack_start(c, False, False, 0)
        c.show()
        c.set_editable(True)
        self.connect('delete_event', self.quit)
项目:pedro    作者:saandial    | 项目源码 | 文件源码
def main():
    win = Gtk.Window()
    win.connect('destroy', Gtk.main_quit)
    win.set_default_size(Width, Height)

    global drawingarea
    drawingarea = Gtk.DrawingArea()
    drawingarea.connect('draw', draw)

    drawing_event_box = Gtk.EventBox()
    drawing_event_box.add(drawingarea)
    drawing_event_box.connect('button-press-event', mouse_pressed)
    drawing_event_box.connect('motion-notify-event', mouse_dragged)

    check_useIk = Gtk.CheckButton("Lock Forearm & Hand")
    check_useIk.set_active(True)
    check_useIk.connect("toggled", check_toggled)

    box = Gtk.VBox()
    box.pack_start(check_useIk, False, True, 0)
    box.pack_start(drawing_event_box, True, True, 0)
    win.add(box)
    win.show_all()
    Gtk.main()
项目:dell-recovery    作者:dell    | 项目源码 | 文件源码
def __init__(self, title):
        Gtk.Window.__init__(self, title=title)
        self.set_border_width(10)
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.add(vbox)
        self.progressbar = Gtk.ProgressBar()
        self.progressbar.pulse()
        self.progressbar.set_show_text(True)
        vbox.pack_start(self.progressbar, True, True, 0)
        self.timeout_id = GObject.timeout_add(50, self.on_timeout, None)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_deletable(False)
        self.set_decorated(False)
        self.set_resizable(False)
        self.set_keep_above(True)
        self.fraction = 0.0
        self.pulse = True
项目:chromecast-player    作者:wa4557    | 项目源码 | 文件源码
def __init__(self, playlist, enable_web, transcoder, probe, preferred_transcoder, counter):
        self.win = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)

        theme = Gtk.IconTheme.get_default()
        self.playimage = theme.load_icon("media-playback-start", 16,0)
        self.store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, int, int, str, str, str, str)
        self.selection_index = None 
        self.create_model(playlist)
        if counter:
            self.store[counter][0] = self.playimage
        self.playlist_counter = None
        self.play_now = False
        self.playlist_changed = False
        self.double_clicked = False
        self.drag_index = None
        self.transcoder = transcoder
        self.number_clicked = 0
        self.double_clicked_index = None
        self.probe = probe
        self.preferred_transcoder = preferred_transcoder
        self.enable_web = enable_web
        self.show_image = True
        self.sorted_index = None
项目:chromecast-player    作者:wa4557    | 项目源码 | 文件源码
def _combo_changed_clients(self, widget):
        ind = widget.get_active()
        if ind == -1:
            return
        else:
            dev = self.chromecasts[ind]
        if not dev:
            return
        self.connect_to_chromecast(dev)
        if self.cast:
            self.cast.wait()
        else:
            self.clients_combo.set_active(-1)
            message = ("Cannot connect to chromecast. You sure you are still connected to the same network?")
            win = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
            dialog = Gtk.MessageDialog(win, None, Gtk.MessageType.ERROR,
                           Gtk.ButtonsType.OK, message)
            dialog.run()
            dialog.destroy()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, title='apart')
        self.dying = False
        self.status_listener = MessageListener(
            on_message=lambda m: GLib.idle_add(self.on_status_msg, m),
            message_predicate=lambda m: m['type'] == 'status')
        self.core = ApartCore(listeners=[self.status_listener],
                              on_finish=lambda code: GLib.idle_add(self.on_delete))
        self.sources = None
        self.sources_interest = []  # array of callbacks on sources update

        self.set_default_size(height=300, width=300 * 16/9)

        self.loading_body = LoadingBody()
        self.clone_body = None

        self.add(self.loading_body)

        self.connect('delete-event', self.on_delete)

        self.set_icon_name('apart')
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def main():
    win = Window()
    # allow keyboard interrupt / nodemon to end program cleanly
    for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGUSR2]:
        signal.signal(sig, lambda _s, _f: win.on_delete())

    style_provider = Gtk.CssProvider()
    style_provider.load_from_path(os.path.dirname(os.path.realpath(__file__)) + "/apart.css")
    Gtk.StyleContext.add_provider_for_screen(
        Gdk.Screen.get_default(),
        style_provider,
        Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
    )

    win.show_all()
    Gtk.main()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self, root: Gtk.Window, text: str,
                 ok_button_text: str = Gtk.STOCK_OK,
                 cancel_button_text: str = Gtk.STOCK_CANCEL,
                 header: str = '',
                 message_type: Gtk.MessageType = Gtk.MessageType.WARNING):
        Gtk.MessageDialog.__init__(self, root, 0, message_type=message_type)
        self.set_title(header)
        self.icon = Gtk.Image()
        self.icon.set_from_icon_name(appropriate_icon(message_type), Gtk.IconSize.LARGE_TOOLBAR)
        self.text = Gtk.Label(text)
        heading = Gtk.Box()
        heading.add(self.icon)
        heading.add(self.text)

        self.get_message_area().add(heading)
        self.get_message_area().set_spacing(0)
        self.add_button(cancel_button_text, Gtk.ResponseType.CANCEL)
        self.add_button(ok_button_text, Gtk.ResponseType.OK)
        self.show_all()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self, root: Gtk.Window, text: str,
                 ok_button_text: str = Gtk.STOCK_OK,
                 header: str = '',
                 message_type: Gtk.MessageType = Gtk.MessageType.ERROR):
        Gtk.MessageDialog.__init__(self, root, 0, message_type=message_type)
        self.set_title(header)
        self.icon = Gtk.Image()
        self.icon.set_from_icon_name(appropriate_icon(message_type), Gtk.IconSize.LARGE_TOOLBAR)
        self.text = Gtk.Label(text)
        heading = Gtk.Box()
        heading.add(self.icon)
        heading.add(self.text)

        self.get_message_area().add(heading)
        self.get_message_area().set_spacing(0)
        self.add_button(ok_button_text, Gtk.ResponseType.OK)
        self.show_all()
项目:Remarkable    作者:jamiemcg    | 项目源码 | 文件源码
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)
项目:hackfair-speech    作者:DjangoGirlsSeoul    | 项目源码 | 文件源码
def __init__(self):
        window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        window.set_title("Audio-Player")
        window.set_default_size(300, -1)
        window.connect("destroy", Gtk.main_quit, "WM destroy")
        vbox = Gtk.VBox()
        window.add(vbox)
        self.entry = Gtk.Entry()
        vbox.pack_start(self.entry, False, True, 0)
        self.button = Gtk.Button("Start")
        self.button.connect("clicked", self.start_stop)
        vbox.add(self.button)
        window.show_all()

        self.player = Gst.ElementFactory.make("playbin", "player")
        fakesink = Gst.ElementFactory.make("fakesink", "fakesink")
        self.player.set_property("video-sink", fakesink)
        bus = self.player.get_bus()
        bus.add_signal_watch()
        bus.connect("message", self.on_message)
项目:ghetto_omr    作者:pohzhiee    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)
        somegrid = toolgrid(2)

        button1 = toolbutton("browser")
        somegrid.add(button1)

        button2 = toolbutton("alienarena")
        somegrid.add(button2)

        button3 = toolbutton("live")
        somegrid.add(button3)

        button4 = toolbutton("cs-network")
        somegrid.add(button4)


        self.add(somegrid)
项目:ghetto_omr    作者:pohzhiee    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self,title="Ghetto OMR")
        self.set_resizable(True)
        self.connect("configure-event",self.new_dim)
        self.connect("delete-event",Gtk.main_quit)

        self.win_width = 200
        self.win_height = 200

        something = Gtk.Label("SOMETHING")
        self.maximize()
        self.count =0


        self.main = MainGrid(self)
        self.add(self.main)
        #
        # self.main.destroy()
        # self.main = Gtk.Label("SOMETHING")
        # self.add(self.main)
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def __init__(self, title): 
        Gtk.Window.__init__(self, title=title)

        self.filename = None

        self.config_dir = os.path.expanduser("~/.config/PyFlowChart")
        self.config_file = os.path.expanduser("~/.config/PyFlowChart/config")
        self.chart_dir = os.path.expanduser("~/.config/PyFlowChart/charts")
        self.check_config()

        self.course_manager = CourseManager()
        self.modify_grid = ModifyGrid()
        self.about_dialog = about_dialog(self)
        # Preferences dialog should work like this, to be implemented
        #self.preferences_dialog = preferences_dialog(self)

        self.parse_config()
项目:Simple-User-Input-Sculpture-Generation    作者:ClaireKincaid    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, title = "Choose a method of Sculpture Generation")
        self.set_border_width(10)
        self.set_default_size(400, 50)

        #initiates Gtk box window
        self.box = Gtk.Box(spacing = 6)
        self.add(self.box)

        #Initializes Vector Animation Button, places in box
        self.VectorButton = Gtk.Button(label = "Vector Animation")
        self.VectorButton.connect("clicked", self.on_VectorButton_clicked)
        self.VectorButton.connect("clicked", Gtk.main_quit)
        self.box.pack_start(self.VectorButton, True, True, 0)

        #Initializes Perlin Noise Button, places in box
        self.PerlinButton = Gtk.Button(label = "Perlin Noise")
        self.PerlinButton.connect("clicked", self.on_PerlinButton_clicked)
        self.PerlinButton.connect("clicked", Gtk.main_quit)
        self.box.pack_start(self.PerlinButton, True, True, 0)

    #when VectorButton clicked, toggles to new GUI
项目:nautilus-folder-icons    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, folders):
        GObject.GObject.__init__(self)
        Thread.__init__(self)
        Gtk.Window.__init__(self)
        # 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)

        # Widgets & Accelerators
        self._build_header_bar()
        self._build_content()
        self._setup_accels()
项目:keepass-menu    作者:frostidaho    | 项目源码 | 文件源码
def _get_seat_n_window():
    "Return a Gdk seat (essentially input devices) and window"
    display = Gdk.Display.get_default()
    screen = display.get_default_screen()
    visual = screen.get_rgba_visual()
    # see gnome-screenshot source: create_select_window()
    # screenshot-area-selection.c
    win = Gtk.Window(type=Gtk.WindowType.POPUP)
    if screen.is_composited():
        win.set_visual(visual)
        win.set_app_paintable(True)
    win.move(-100, -100)
    win.resize(10, 10)
    win.show()
    win.set_accept_focus(True)
    win.set_can_focus(True)
    seat = display.get_default_seat()
    return seat, win.get_window()
项目:games_nebula_goglib_scripts    作者:yancharkin    | 项目源码 | 文件源码
def create_progressbar_window(self):

        self.progressbar_window = Gtk.Window(
            title = "Planescape: Torment",
            type = Gtk.WindowType.TOPLEVEL,
            window_position = Gtk.WindowPosition.CENTER_ALWAYS,
            resizable = False,
            default_width = 360
            )

        self.progressbar = Gtk.ProgressBar(
            hexpand = True,
            show_text = True,
            text = _("Patching..."),
            pulse_step = 0.1,
            margin_top = 10,
            margin_bottom = 10,
            margin_left = 10,
            margin_right = 10
            )

        self.progressbar_window.add(self.progressbar)
项目:games_nebula_goglib_scripts    作者:yancharkin    | 项目源码 | 文件源码
def create_main_window(self):

        self.main_window = Gtk.Window(
            title = _("Omikron: The Nomad Soul"),
            type = Gtk.WindowType.TOPLEVEL,
            window_position = Gtk.WindowPosition.CENTER_ALWAYS,
            resizable = False,
            )
        self.main_window.connect('delete-event', self.quit_app)

        button_patch = Gtk.Button(
            label = _("Old Games Widescreen Patch"),
            margin_top = 10,
            margin_bottom = 10,
            margin_left = 10,
            margin_right = 10
            )
        button_patch.connect('clicked', self.cb_button_patch)

        self.main_window.add(button_patch)
        self.main_window.show_all()
项目:gpt    作者:encarsia    | 项目源码 | 文件源码
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:
            print(_("Select clicked"))
            print(_("Folder selected: ") + dialog.get_filename())
            self.selectedfolder = dialog.get_filename()
        elif response == Gtk.ResponseType.CANCEL:
            print(_("Cancel clicked"))
            self.selectedfolder = cli.stdir

        dialog.destroy()
项目:hachoir3    作者:vstinner    | 项目源码 | 文件源码
def __init__(self):
        self.main_window = Gtk.Window()
        self.main_window.set_border_width(5)
        self.main_window.connect("destroy", self._destroy)

        self.main_vbox = Gtk.VBox()

        self.select_hbox = Gtk.HBox()
        self.select_button = Gtk.Button("Select")
        self.select_button.connect("clicked", self._select_clicked)
        self.select_hbox.pack_start(self.select_button, False, True, 0)
        self.file_combo = Gtk.ComboBoxText()
        self.file_combo.connect("changed", self._file_combo_changed)
        self.select_hbox.pack_start(self.file_combo, True, True, 0)
        self.main_vbox.pack_start(self.select_hbox, False, True, 0)

        self.metadata_table = Gtk.Table(1, 1)
        self.metadata_table.attach(
            Gtk.Label("Select a file to view metadata information..."), 0, 1, 0, 1)
        self.main_vbox.pack_start(self.metadata_table, True, True, 0)

        self.main_window.add(self.main_vbox)
        self.main_window.show_all()
项目:boids    作者:inconvergent    | 项目源码 | 文件源码
def __init__(self, n, front, back, step):
    from gi.repository import Gtk
    from gi.repository import GObject

    Render.__init__(self, n, front, back)

    window = Gtk.Window()
    self.window = window
    window.resize(self.n, self.n)

    self.step = step

    window.connect("destroy", self.__destroy)
    darea = Gtk.DrawingArea()
    # darea.connect("expose-event", self.expose)
    self.darea = darea

    window.add(darea)
    window.show_all()

    #self.cr = self.darea.window.cairo_create()
    self.steps = 0
    GObject.idle_add(self.step_wrap)
项目:tmsu-nautilus-python    作者:talklittle    | 项目源码 | 文件源码
def __init__(self, files):
        self.files = files

        Gtk.Window.__init__(self, title="TMSU")
        self.set_size_request(200, 100)
        self.set_border_width(10)
        self.set_type_hint(Gdk.WindowTypeHint.DIALOG)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.add(vbox)

        prompt_text = 'Add (space-separated) tags to %d file%s' % (len(files), '' if len(files)==1 else 's')
        self.prompt_label = Gtk.Label(label=prompt_text)
        vbox.pack_start(self.prompt_label, True, True, 0)

        self.entry = Gtk.Entry()
        self.entry.connect("activate", self.on_entry_activated)
        vbox.pack_start(self.entry, True, True, 0)

        self.button = Gtk.Button(label="Add")
        self.button.connect("clicked", self.on_button_clicked)
        vbox.pack_start(self.button, True, True, 0)
项目:talks    作者:inconvergent    | 项目源码 | 文件源码
def __init__(self, n, front, back, step):

    from gi.repository import Gtk
    from gi.repository import GObject

    Render.__init__(self, n, front, back)

    window = Gtk.Window()
    self.window = window
    window.resize(self.n, self.n)

    self.step = step

    window.connect("destroy", self.__destroy)
    darea = Gtk.DrawingArea()
    # darea.connect("expose-event", self.expose)
    self.darea = darea

    window.add(darea)
    window.show_all()

    #self.cr = self.darea.window.cairo_create()
    self.steps = 0
    GObject.idle_add(self.step_wrap)
项目:ssh-manager    作者:Doka-NT    | 项目源码 | 文件源码
def __init__(
            self, manager: Manager,
            window_config: Window,
            command_ssh: AbstractCommand,
            command_edit: AbstractCommand
    ):
        self._listbox = None
        self._frame = None
        self._scrollable = None
        self._btn_reload = None
        self._btn_settings = None
        self._list_store = Gtk.ListStore(str)

        self.__command_ssh = command_ssh
        self.__command_edit = command_edit
        self._manager = manager
        self._window_config = window_config
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_window():
    win = Gtk.Window()
    win.set_size_request(300, 200)

    HW_TEST_RESULT = {
        'hardware::gps': 'yes',
        'hardware::video:opengl': 'no',
    }

    # add it
    hwbox = HardwareRequirementsBox()
    hwbox.set_hardware_requirements(HW_TEST_RESULT)
    win.add(hwbox)

    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_buttons_window():
    win = Gtk.Window()
    win.set_size_request(200, 200)

    vb = Gtk.VBox(spacing=12)
    win.add(vb)

    link = Link("<small>test link</small>", uri="www.google.co.nz")
    vb.pack_start(link, False, False, 0)

    button = Gtk.Button()
    button.set_label("channels")
    channels_button = ChannelSelector(button)
    channels_button.parent_style_type = Gtk.Window
    channels_button.set_build_func(_build_channels_list)
    hb = Gtk.HBox()
    hb.pack_start(button, False, False, 0)
    hb.pack_start(channels_button, False, False, 0)
    vb.pack_start(hb, False, False, 0)

    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_symbolic_icons_window():
    win = Gtk.Window()
    win.set_border_width(20)
    hb = Gtk.HBox(spacing=12)
    win.add(hb)
    ico = SymbolicIcon("available")
    hb.add(ico)
    ico = PendingSymbolicIcon("pending")
    ico.start()
    ico.set_transaction_count(33)
    hb.add(ico)
    ico = PendingSymbolicIcon("pending")
    ico.start()
    ico.set_transaction_count(1)
    hb.add(ico)
    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_window():

    from softwarecenter.testutils import get_test_gtk3_icon_cache
    icons = get_test_gtk3_icon_cache()

    view = PendingPane(icons)

    # gui
    scroll = Gtk.ScrolledWindow()
    scroll.add_with_viewport(view)

    win = Gtk.Window()
    win.add(scroll)
    view.grab_focus()
    win.set_size_request(500, 200)
    win.show_all()
    win.connect("destroy", Gtk.main_quit)

    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_window():

    from softwarecenter.testutils import (get_test_db,
                                          get_test_datadir,
                                          get_test_gtk3_viewmanager,
                                          get_test_pkg_info,
                                          get_test_gtk3_icon_cache,
                                          )
    vm = get_test_gtk3_viewmanager()
    db = get_test_db()
    cache = get_test_pkg_info()
    datadir = get_test_datadir()
    icons = get_test_gtk3_icon_cache()

    p = GlobalPane(vm, datadir, db, cache, icons)

    win = Gtk.Window()
    win.set_size_request(400, 200)
    win.set_data("pane", p)
    win.connect("destroy", Gtk.main_quit)
    win.add(p)
    win.show_all()
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_window():
    win = Gtk.Window()
    win.set_size_request(300, 200)

    HW_TEST_RESULT = {
        'hardware::gps': 'yes',
        'hardware::video:opengl': 'no',
    }

    # add it
    hwbox = HardwareRequirementsBox()
    hwbox.set_hardware_requirements(HW_TEST_RESULT)
    win.add(hwbox)

    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_container_window():
    win = Gtk.Window()
    win.set_size_request(500, 300)
    f = FlowableGrid()

    import buttons

    for i in range(10):
        t = buttons.CategoryTile("test", "folder")
        f.add_child(t)

    scroll = Gtk.ScrolledWindow()
    scroll.add_with_viewport(f)

    win.add(scroll)
    win.show_all()

    win.connect("destroy", lambda x: Gtk.main_quit())
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_buttons_window():
    win = Gtk.Window()
    win.set_size_request(200, 200)

    vb = Gtk.VBox(spacing=12)
    win.add(vb)

    link = Link("<small>test link</small>", uri="www.google.co.nz")
    vb.pack_start(link, False, False, 0)

    button = Gtk.Button()
    button.set_label("channels")
    channels_button = ChannelSelector(button)
    channels_button.parent_style_type = Gtk.Window
    channels_button.set_build_func(_build_channels_list)
    hb = Gtk.HBox()
    hb.pack_start(button, False, False, 0)
    hb.pack_start(channels_button, False, False, 0)
    vb.pack_start(hb, False, False, 0)

    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_symbolic_icons_window():
    win = Gtk.Window()
    win.set_border_width(20)
    hb = Gtk.HBox(spacing=12)
    win.add(hb)
    ico = SymbolicIcon("available")
    hb.add(ico)
    ico = PendingSymbolicIcon("pending")
    ico.start()
    ico.set_transaction_count(33)
    hb.add(ico)
    ico = PendingSymbolicIcon("pending")
    ico.start()
    ico.set_transaction_count(1)
    hb.add(ico)
    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_window():

    from softwarecenter.testutils import get_test_gtk3_icon_cache
    icons = get_test_gtk3_icon_cache()

    view = PendingPane(icons)

    # gui
    scroll = Gtk.ScrolledWindow()
    scroll.add_with_viewport(view)

    win = Gtk.Window()
    win.add(scroll)
    view.grab_focus()
    win.set_size_request(500, 200)
    win.show_all()
    win.connect("destroy", Gtk.main_quit)

    return win
项目:batterym    作者:maks-a    | 项目源码 | 文件源码
def battery_monitor(self, _):
        if self.window is None:
            self.window = gtk.Window()
            self.window.connect('delete-event', self.close_window)
            self.window.set_title('Battery Monitor')
            self.window.set_border_width(10)
            self.window.set_size_request(700, 500)
            self.window.set_resizable(False)
            self.window.set_position(gtk.WindowPosition.CENTER)
            self.window.set_icon_from_file(BATTERY_MONITOR_ICON)
            self.window.vbox = gtk.Box()
            self.window.vbox.set_spacing(5)
            self.window.vbox.set_orientation(gtk.Orientation.VERTICAL)
            self.window.add(self.window.vbox)
            self.image = gtk.Image()
            self.image.set_from_file(CAPACITY_HISTORY_CHART)
            self.window.vbox.pack_start(self.image, False, False, 0)
        if not self.window.props.visible:
            self.window.show_all()
项目:games_nebula    作者:yancharkin    | 项目源码 | 文件源码
def create_loading_window(self):

        self.loading_window = Gtk.Window(
            title = "Games Nebula",
            icon = app_icon,
            type = Gtk.WindowType.POPUP,
            window_position = Gtk.WindowPosition.CENTER_ALWAYS,
            resizable = False
            )

        self.box_loading_window = Gtk.Box()

        loading_icon = app_icon.scale_simple(32, 32, InterpType.BILINEAR)

        self.image_loading = Gtk.Image(
            pixbuf = loading_icon,
            margin_left = 10,
            margin_right = 10
            )

        self.label_loading = Gtk.Label(
            label = _("Launching 'Games Nebula'"),
            margin_right = 10,
            margin_left = 10,
            margin_top = 20,
            margin_bottom = 20
            )

        self.box_loading_window.pack_start(self.image_loading, True, True, 0)
        self.box_loading_window.pack_start(self.label_loading, True, True, 0)
        self.loading_window.add(self.box_loading_window)
        self.loading_window.show_all()
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self):

        Gtk.Window.__init__(self, title='My Window Title')
        self.connect('delete-event', Gtk.main_quit)        

        store = Gtk.ListStore(str, str, str, str)
        self.populate_store(store)

        self.treeview = Gtk.TreeView(model=store)

        renderer = Gtk.CellRendererText()

        column_catalog = Gtk.TreeViewColumn('Catalog Name', renderer, text=0)
        column_catalog.set_sort_column_id(0)        
        self.treeview.append_column(column_catalog)

        column_dbname = Gtk.TreeViewColumn('Database Name', renderer, text=1)
        column_dbname.set_sort_column_id(1)
        self.treeview.append_column(column_dbname)

        column_charset = Gtk.TreeViewColumn('Character Set', renderer, text=2)
        column_charset.set_sort_column_id(2)
        self.treeview.append_column(column_charset)

        column_collation = Gtk.TreeViewColumn('Collation', renderer, text=3)
        column_collation.set_sort_column_id(3)
        self.treeview.append_column(column_collation)

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_policy(
            Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled_window.add(self.treeview)
        scrolled_window.set_min_content_height(200)

        self.add(scrolled_window)
        self.show_all()

    # Add data to ListStore
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def generate_window(self):
        Gtk.Window.__init__(self, type=Gtk.WindowType.TOPLEVEL,
                            title=_("Add a new account"),
                            modal=True, destroy_with_parent=True)
        self.connect("delete-event", self.close_window)
        self.resize(500, 350)
        self.set_size_request(500, 350)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_resizable(False)
        self.set_transient_for(self.parent)
        self.notification = InAppNotification()

        self.connect("key_press_event", self.on_key_press)
项目:mama    作者:maateen    | 项目源码 | 文件源码
def __init__(self, text, url):
        Gtk.Window.__init__(self)
        self.text = text
        self.url = url
项目:mama    作者:maateen    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)
        dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO,
                                   Gtk.ButtonsType.OK,
                                   "Mama! New version Installed Successfully")
        dialog.run()
        print("Info dialog closed")

        dialog.destroy()

# Initializing the parent and directory
项目:mama    作者:maateen    | 项目源码 | 文件源码
def __init__(self):
        w=Gtk.Window()
        dialog = Gtk.FileChooserDialog(_("Choose a file"), w,Gtk.FileChooserAction.OPEN,(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
        dialog.set_default_size(800, 400)

        response = dialog.run()
        self.module = '-1'
        if response == Gtk.ResponseType.OK:
            self.module=dialog.get_filename()
        elif response == Gtk.ResponseType.CANCEL:
            print("Cancel clicked")

        dialog.destroy()