python类Window()的实例源码

tmsu_tags.py 文件源码 项目:tmsu-nautilus-python 作者: talklittle 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
render.py 文件源码 项目:talks 作者: inconvergent 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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)
window.py 文件源码 项目:ssh-manager 作者: Doka-NT 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
labels.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
buttons.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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
symbolic_icons.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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
pendingpane.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
globalpane.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
labels.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
containers.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
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
buttons.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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
symbolic_icons.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
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
pendingpane.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
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
indicator.py 文件源码 项目:batterym 作者: maks-a 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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.py 文件源码 项目:games_nebula 作者: yancharkin 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()
recipe-578774.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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
add_account.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
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)
updater.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, text, url):
        Gtk.Window.__init__(self)
        self.text = text
        self.url = url
install.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
ModuleSelection.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()


问题


面经


文章

微信
公众号

扫码关注公众号