Beispiel #1
0
    def on_active(app):
        win = Gtk.ApplicationWindow(application=app)
        clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)

        grid = Gtk.Grid()

        label = Gtk.Label(
            label=
            "SCREENSHOTS GO BURRRR\nYOU HAVE NEVER SEEN SCREENSHOTS BURRRR LIKE THIS EVER BEFORE!"
        )

        btn = Gtk.Button(label="Take Screenshot")
        btn.connect('clicked',
                    lambda x: clipboard.set_text(upload_screenshot(app), -1))

        # Adding elements to the grid
        grid.attach(label, 0, 0, 1, 1)
        grid.attach(btn, 0, 1, 1, 1)

        grid.set_margin_top(10)
        grid.set_margin_left(10)
        grid.set_margin_right(10)
        grid.set_margin_bottom(10)

        label.set_margin_bottom(10)

        win.add(grid)
        win.show_all()
def on_activate(app):
    win = Gtk.ApplicationWindow(application=app)
    win.set_title('Helooo')
    btn = Gtk.Button(label="Hello, World!")
    btn.connect('clicked', lambda x: win.destroy())
    win.add(btn)
    win.show_all()
Beispiel #3
0
def on_activate(app):
    win = Gtk.ApplicationWindow(application=app)
    win.set_default_size(400, 300)
    win.set_title("Embedding in GTK4")

    fig = Figure(figsize=(5, 4), dpi=100)
    ax = fig.add_subplot(1, 1, 1)
    t = np.arange(0.0, 3.0, 0.01)
    s = np.sin(2 * np.pi * t)
    ax.plot(t, s)

    vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    win.set_child(vbox)

    # Add canvas to vbox
    canvas = FigureCanvas(fig)  # a Gtk.DrawingArea
    canvas.set_hexpand(True)
    canvas.set_vexpand(True)
    vbox.append(canvas)

    # Create toolbar
    toolbar = NavigationToolbar(canvas, win)
    vbox.append(toolbar)

    win.show()
Beispiel #4
0
    def on_activate(self, data=None):
        window = Gtk.ApplicationWindow(application=self)
        self.add_window(window)

        screen = Wnck.Screen.get_default()
        screen.connect('window-opened', self.on_screen_window_opened)
        logger.info('Listening for newly opened windows.')
Beispiel #5
0
    def __init__(self, application):
        self.Application = application
        # self.iScheduler = BackgroundScheduler()
        # Read GUI from file and retrieve objects from Gtk.Builder
        # try:
        #     GtkBuilder = Gtk.Builder.new_from_file("gtkapp_login.ui")
        #     GtkBuilder.connect_signals(gtkapp_portion.lgn(application, GtkBuilder))
        # except GObject.GError:
        #     print("Error reading GUI file")
        #     raise

        # Fire up the main window
        # self.MainWindow = GtkBuilder.get_object("LoginWindow")
        self.MainWindow = Gtk.ApplicationWindow()
        self.MainWindow.set_default_size(800, 600)
        self.MainWindow.set_application(application)
        # self.MainWindow.connect("realize", self.loginbtn_clicked_cb)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        button1 = Gtk.Button()
        button1 = Gtk.Button(name="but1", label="Hello")
        button1.connect("clicked", self.loginbtn_clicked_cb)
        box.pack_start(button1, True, True, 0)

        self.MainWindow.add(box)
        self.MainWindow.show_all()
        if self.Application.get_window_by_id(2):
            self.Application.get_window_by_id(2).destroy()
Beispiel #6
0
    def on_activate(self, *args, **kwargs):
        window = Gtk.ApplicationWindow()
        window.set_title("Simple Barcode Reader")
        window.set_default_size(400, 300)

        vbox = Gtk.Box(Gtk.Orientation.HORIZONTAL, 0)
        vbox.set_margin_top(3)
        vbox.set_margin_bottom(3)
        window.add(vbox)

        reader = BarcodeReaderGTK()
        reader.connect('barcode', self.on_barcode)
        vbox.pack_start(reader, True, True, 0)
        self.playing = False

        #self.image = Gtk.Image()
        self.image = ScalingImage()
        vbox.pack_end(self.image, True, True, 0)

        self.playButtonImage = Gtk.Image()
        self.playButtonImage.set_from_stock("gtk-media-play",
                                            Gtk.IconSize.BUTTON)
        self.playButton = Gtk.Button.new()
        self.playButton.add(self.playButtonImage)
        self.playButton.connect("clicked", self.playToggled)
        vbox.pack_end(self.playButton, False, False, 0)

        window.show_all()
        self.add_window(window)
Beispiel #7
0
def on_activate(app):
    global PAGE_SIZE
    getconf = subprocess.run(["getconf", "PAGE_SIZE"], capture_output=True)
    PAGE_SIZE = int(getconf.stdout.strip())

    win = Gtk.ApplicationWindow(application=app)
    win.set_keep_above(True)

    sample_seconds = 1.0
    cpu_graphs = GraphCollection(sample_seconds, new_graph=CPUGraph)
    mem_graphs = GraphCollection(sample_seconds, new_graph=CPUGraph)
    net_graphs = GraphCollection(sample_seconds, new_graph=BytesGraph)
    io_graphs = GraphCollection(sample_seconds, new_graph=BytesGraph)
    pid_stats_collector = PIDStatsCollector(sample_seconds,
                                            cpu_graphs.update_graphs,
                                            mem_graphs.update_graphs,
                                            net_graphs.update_graphs,
                                            io_graphs.update_graphs)

    if os.getenv('ONLY_CPU'):
        win.add(cpu_graphs)
    else:
        notebook = Gtk.Notebook()
        notebook.connect("key-press-event", on_key_press)
        notebook.append_page(cpu_graphs, Gtk.Label(label='CPU'))
        notebook.append_page(mem_graphs, Gtk.Label(label='Memory'))
        notebook.append_page(net_graphs, Gtk.Label(label='Network'))
        notebook.append_page(io_graphs, Gtk.Label(label='IO'))
        notebook.foreach(lambda child: notebook.child_set_property(
            child, "tab-expand", True))
        win.add(notebook)

    win.show_all()
Beispiel #8
0
 def do_activate(self):
     if not self.window:
         self.window = window = Gtk.ApplicationWindow(application=self,
                                             title="Pongo")
         window.connect("destroy", self.quit_app)
         window.set_name("finderWindow")
         window.set_default_size(768, 768)
         window.move(75, 50)
         window.set_border_width(30)
         box = Gtk.Box(Gtk.Orientation.VERTICAL, 10)
         box.set_homogeneous(False)
         self.finder = finder = FindPongo(self)
         box.pack_start(finder, True, True, 0)
         box.set_orientation(Gtk.Orientation.VERTICAL)
         gobox = Gtk.Box(Gtk.Orientation.HORIZONTAL, 10)
         gobox.set_homogeneous(False)
         self.IPentry = IPentry = Gtk.Entry()
         go = Gtk.Button(None, image=Gtk.Image(stock=Gtk.STOCK_GO_FORWARD))
         go.connect('clicked', self.ip_connect)
         gobox.pack_end(go, False, False, 0)
         gobox.pack_end(IPentry, True, True, 0)
         box.pack_end(gobox, False, False, 0)
         label = Gtk.Label("IP Address/Name:")
         label.props.halign=Gtk.Align.START
         box.pack_end(label, False, False, 0)
         window.add(box)
         box.show_all()
     self.window.present()
    def do_activate(self):
        if not self.window:
            self.window = Gtk.ApplicationWindow(application=self)

            action = Gio.SimpleAction.new("quit", None)
            action.connect("activate", self.on_quit)
            self.add_action(action)

            action = Gio.SimpleAction.new("about", None)
            action.connect("activate", self.on_about)
            self.add_action(action)

            menu = Gio.Menu()
            menu.append('About', 'app.about')
            menu.append("Exit", "app.quit")
            self.set_app_menu(menu)

            icon_theme = Gtk.IconTheme.get_default()
            self.logo = icon_theme.load_icon("applications-other", 128, 0)
            self.window.set_icon(self.logo)

            hb = Gtk.HeaderBar()
            hb.set_show_close_button(True)
            hb.props.title = self.title
            self.window.set_titlebar(hb)

            self.window.set_default_size(640, 480)

            sw = Gtk.ScrolledWindow()
            self.window.add(sw)
            self.window.show_all()

        self.window.present()
Beispiel #10
0
def on_activate(app):
    # Create a new window
    win = Gtk.ApplicationWindow(application=app)
    win.set_title("Squares")
    icon = DemoWidget()
    win.set_child(icon)
    win.present()
Beispiel #11
0
    def __init__(self, is_main=True):
        """Create password generator window; parameter is_main controls whether
		closing the window will quit the application as a whole.
		"""
        # create toggle buttons, number spinner, password entry and button
        self.toggle_abc = self.create_toggle("abc", True)
        self.toggle_ABC = self.create_toggle("ABC", True)
        self.toggle_123 = self.create_toggle("123", True)
        self.toggle_pct = self.create_toggle("$%&", False)
        self.number = Gtk.SpinButton.new_with_range(5, 50, 1)
        self.number.set_value(16)
        self.number.connect("value-changed", self.do_generate)
        self.password = Gtk.Entry.new()
        button = Gtk.Button.new_with_label("New")
        button.connect("clicked", self.do_generate)

        # create initial password
        self.do_generate()

        # assemble grid
        grid = Gtk.Grid.new()
        for i, w in enumerate((self.toggle_abc, self.toggle_ABC,
                               self.toggle_123, self.toggle_pct, self.number)):
            grid.attach(w, i, 0, 1, 1)
        grid.attach(button, 0, 1, 1, 1)
        grid.attach(self.password, 1, 1, 4, 1)

        # put it all together in a window
        self.window = Gtk.ApplicationWindow(title=f"Password Generator")
        self.window.set_resizable(False)
        self.window.add(grid)
        self.window.show_all()
        if is_main:
            self.window.connect("destroy", Gtk.main_quit)
Beispiel #12
0
 def do_activate(self):
     window = Gtk.ApplicationWindow(application=self)
     widget = self.widgetClass()
     widget.connect("notify::x", self.on_notify_xy)
     widget.connect("notify::y", self.on_notify_xy)
     window.add(widget)
     window.show_all()
Beispiel #13
0
    def do_startup(self):
        """Gtk.Application.run() will call this function()"""

        Gtk.Application.do_startup(self)
        gtk_window = Gtk.ApplicationWindow(application=self)
        gtk_window.set_title('AppKit')
        webkit_web_view = WebKit.WebView()
        webkit_web_view.load_uri('http://localhost:' + str(self.port))

        screen = Gdk.Screen.get_default()
        monitor_geometry = screen.get_primary_monitor()
        monitor_geometry = screen.get_monitor_geometry(monitor_geometry)

        settings = webkit_web_view.get_settings()
        settings.set_property('enable-universal-access-from-file-uris', True)
        settings.set_property('enable-file-access-from-file-uris', True)
        settings.set_property('default-encoding', 'utf-8')
        gtk_window.set_default_size(
            monitor_geometry.width * 1.0 / 2.0,
            monitor_geometry.height * 3.0 / 5.0,
        )
        scrollWindow = Gtk.ScrolledWindow()
        scrollWindow.add(webkit_web_view)
        gtk_window.add(scrollWindow)
        gtk_window.connect('delete-event', self._on_gtk_window_destroy)
        webkit_web_view.connect('notify::title', self._on_notify_title)
        self.gtk_window = gtk_window
        self.webkit_web_view = webkit_web_view
        gtk_window.show_all()
Beispiel #14
0
    def on_app_startup(self, app):
        self.window = Gtk.ApplicationWindow(application=app)
        self.window.set_default_size(*self.conf['window-size'])
        self.window.set_title(Config.APPNAME)
        self.window.props.hide_titlebar_when_maximized = True
        self.window.set_icon(self.theme['app-logo'])
        app.add_window(self.window)
        self.window.connect('check-resize', self.on_main_window_resized)
        self.window.connect('delete-event', self.on_main_window_deleted)

        self.accel_group = Gtk.AccelGroup()
        self.window.add_accel_group(self.accel_group)
        self.fullscreen_sid = 0
        self.fullscreen_timestamp = 0

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

        self.player = Player(self)
        box.pack_start(self.player, False, False, 0)

        self.notebook = Gtk.Notebook()
        self.notebook.props.tab_pos = Gtk.PositionType.BOTTOM
        self.notebook.get_style_context().add_class('main_tab')
        box.pack_start(self.notebook, True, True, 0)
        self.init_notebook()
        self.notebook.connect('switch-page', self.on_notebook_switch_page)
        self.init_status_icon()

        # load default styles when all widgets have been constructed.
        self.load_styles()
Beispiel #15
0
 def do_activate(self):
     window = Gtk.ApplicationWindow(application=self)
     window.set_icon_name('mlv.knrf.pastebin_reader')
     window.set_titlebar(self.mk_title_bar())
     
     window.add(self.mk_switch(self.mk_item_page(), self.mk_reader_page(), self.mk_category_page()))
     window.set_default_size(720, 1300)
     window.show_all()
 def do_activate(self):
     # We only allow a single window and raise any existing ones
     if not self.window:
         # Windows are associated with the application
         # when the last one is closed the application shuts down
         self.window = Gtk.ApplicationWindow(application=self,
                                             title="Main Window")
     self.window.present()
Beispiel #17
0
    def _create_window(self):
        self.window = Gtk.ApplicationWindow(application=self,
                                            title=truncate_with_ellipses(
                                                self.executable["filename"],
                                                MAX_EXEC_CHAR_LENGTH * 4),
                                            skip_taskbar_hint=True,
                                            resizable=False)
        self.window.set_position(Gtk.WindowPosition.CENTER)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                      margin=18,
                      spacing=18,
                      visible=True)

        information_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
                                  halign=Gtk.Align.START,
                                  hexpand=True,
                                  margin_left=18,
                                  spacing=36)

        icon = Gio.ThemedIcon(name="dialog-warning-symbolic")
        image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.DIALOG)
        image.set_valign(Gtk.Align.START)
        information_box.add(image)

        message_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                              valign=Gtk.Align.START,
                              spacing=18)

        label = Gtk.Label(use_markup=True,
                          wrap=True,
                          max_width_chars=40,
                          halign=Gtk.Align.CENTER,
                          label=title(self._get_main_message()))
        message_box.add(label)

        app_alternative_message = self._get_app_alternative_message()
        if app_alternative_message:
            label = Gtk.Label(use_markup=True,
                              wrap=True,
                              max_width_chars=40,
                              halign=Gtk.Align.START,
                              label=app_alternative_message)
            message_box.add(label)

        message_box.add(self._get_unknown_app_warning_message())
        information_box.add(message_box)
        box.add(information_box)

        button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
                             halign=Gtk.Align.END,
                             spacing=6)

        self._get_buttons(button_box)
        box.add(button_box)
        self.window.add(box)

        self.window.show_all()
Beispiel #18
0
def on_activate(app):
    # … create a new window…
    win = Gtk.ApplicationWindow(application=app)
    # … with a button in it…
    btn = Gtk.Button(label='Hello, World!')
    # … which closes the window when clicked
    btn.connect('clicked', lambda x: win.close())
    win.add(btn)
    win.show_all()
Beispiel #19
0
    def on_activate(self, data=None):
        window = Gtk.ApplicationWindow()
        window.set_title("Gtk Gst Barcode Reader")
        reader = BarcodeReaderGTK()
        reader.connect('barcode', self.on_barcode)
        window.add(reader)

        window.show_all()
        self.add_window(window)
Beispiel #20
0
	def do_activate(self):
		self.timedata = []
		self.window = Gtk.ApplicationWindow(application=self)
		self.window.connect("destroy", self.quit_callback)
		titlebar = self.create_titlebar()
		self.window.set_titlebar(titlebar)

		mainbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
		self.window.add(mainbox)

		mainbox2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
		mainbox.pack_start(mainbox2, True, True, 0)

		timevaluebox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
		mainbox2.pack_start(timevaluebox, True, True, 0)

		timeline = self.create_timeline()
		timevaluebox.pack_start(timeline, True, True, 0)

		valuebox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
		timevaluebox.add(valuebox)
		self.samples = Gtk.Label("--")
		valuebox.pack_start(self.samples, True, True, 0)
		self.voltage_in = Gtk.Label("--")
		valuebox.pack_start(self.voltage_in, True, True, 0)
		self.voltage_out = Gtk.Label("--")
		valuebox.pack_start(self.voltage_out, True, True, 0)
		self.ampere_out = Gtk.Label("--")
		valuebox.pack_start(self.ampere_out, True, True, 0)
		self.power = Gtk.Label("--")
		valuebox.pack_start(self.power, True, True, 0)

		buttonbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
		mainbox.add(buttonbox)
		btn_start = Gtk.Button.new_with_label("Start")
		btn_start.connect("clicked", self.btn_start)
		buttonbox.pack_start(btn_start, True, True, 0)
		btn_stop = Gtk.Button.new_with_label("Stop")
		btn_stop.connect("clicked", self.btn_stop)
		buttonbox.pack_start(btn_stop, True, True, 0)
		btn_on = Gtk.Button.new_with_label("On")
		btn_on.connect("clicked", self.btn_on)
		buttonbox.pack_start(btn_on, True, True, 0)
		btn_off = Gtk.Button.new_with_label("Off")
		btn_off.connect("clicked", self.btn_off)
		buttonbox.pack_start(btn_off, True, True, 0)
		btn_read = Gtk.Button.new_with_label("Read")
		btn_read.connect("clicked", self.btn_read)
		buttonbox.pack_start(btn_read, True, True, 0)

		settingbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
		mainbox2.add(settingbox)

		self.volt = self.add_setting(settingbox, "Volt", "", self.volt_set)
		self.ampere = self.add_setting(settingbox, "Ampere", "", self.ampere_set)

		self.window.show_all()
Beispiel #21
0
    def do_activate(self):
        win = self.props.active_window
        if not win:
            win = Gtk.ApplicationWindow(application=self)
            win.set_default_size(400, 300)
            win.set_title('Tiny App')

            label = Gtk.Label(label='Welcome to PyGObject!', visible=True)
            win.add(label)
        win.present()
Beispiel #22
0
    def __init__(self, conf):
        """ Create Password Manager window for given config
		"""
        self.conf = conf
        try:
            self.original_passwords = pwdmgr_core.load_decrypt(self.conf)
        except FileNotFoundError:
            print("File not found... starting new list")
            self.original_passwords = []

        # create search and filtering widgets
        self.search = Gtk.SearchEntry()
        self.search.connect("search-changed", self.do_filter)
        self.mod_only = Gtk.CheckButton(label="Modified Only")
        self.mod_only.set_active(False)
        self.mod_only.connect("toggled", self.do_filter)

        # create tool bar and buttons
        header = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        header.pack_start(Gtk.Label(label="Filter"), False, False, 10)
        header.pack_start(self.search, False, False, 0)
        header.pack_start(self.mod_only, False, False, 10)
        header.pack_start(
            create_button("Select Columns",
                          self.do_filter_columns,
                          is_icon=False), False, False, 0)
        header.pack_start(
            create_button("Password Generator", self.do_genpwd, is_icon=False),
            False, False, 0)
        header.pack_end(
            create_button("list-remove", self.do_remove,
                          "Mark selected for Removal"), False, False, 0)
        header.pack_end(
            create_button("list-add", self.do_add, "Add new Entry"), False,
            False, 0)

        # create table model and body section with table view
        self.create_model()
        self.table = self.create_table()
        self.column_menu = self.create_column_menu()
        table_scroller = Gtk.ScrolledWindow()
        table_scroller.add(self.table)

        body = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        body.pack_start(header, False, False, 0)
        body.pack_start(table_scroller, True, True, 0)

        # put it all together in a window
        self.window = Gtk.ApplicationWindow(
            title=f"Password Manager - {conf.filename}")
        self.window.resize(800, 600)
        self.window.connect("delete-event", self.do_close)
        self.window.connect("destroy", Gtk.main_quit)
        self.window.add(body)
        self.window.show_all()
Beispiel #23
0
    def do_activate(self):
        if not self.window:
            self.window = Gtk.ApplicationWindow(application=self)
            self.window.set_default_size(1100, 800)

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

        self.read_po(self.po)
        self.read_rst(self.rst)

        self.window.show_all()
Beispiel #24
0
    def on_activate(self, app):
        window = Gtk.ApplicationWindow()
        window.set_title("Key List")

        if not self.kpw:
            self.kpw = KeyListWidget(get_usable_keys())
        self.kpw.connect('key-activated', self.on_key_activated)
        self.kpw.connect('key-selected', self.on_key_selected)
        window.add(self.kpw)

        window.show_all()
        self.add_window(window)
Beispiel #25
0
    def on_activate(self, app):
        window = Gtk.ApplicationWindow()
        window.set_title("Key Pre Sign Widget")
        # window.set_size_request(600, 400)

        if not self.psw:
            self.psw = PreSignWidget()

        self.psw.connect('sign-key-confirmed', self.on_sign_key_confirmed)
        window.add(self.psw)

        window.show_all()
        self.add_window(window)
Beispiel #26
0
def on_activate(app):
    window = Gtk.ApplicationWindow(application=app)
    window.set_default_size(300, 200)

    hello_world = Gtk.Label(label="Hello, World!")

    box = Gtk.FlowBox()
    box.add(hello_world)
    # removing the child immediately to simplify the example
    box.remove(hello_world)

    window.add(box)
    window.show_all()
Beispiel #27
0
    def on_activate(self, app):
        window = Gtk.ApplicationWindow()
        window.set_title("Key Fingerprint Scanner Widget")
        window.set_size_request(600, 400)

        if not self.scanwidget:
            self.scanwidget = KeyFprScanWidget()
        self.scanwidget.connect('changed', self.on_text_changed)
        self.scanwidget.connect('barcode', self.on_barcode)
        window.add(self.scanwidget)

        window.show_all()
        self.add_window(window)
Beispiel #28
0
    def do_activate(self, app):
        win = Gtk.ApplicationWindow(title="LOK Document Viewer",
                                    default_height=600,
                                    default_width=800)
        view = LOKDocView.View.new(None, None)

        sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
        win.add(sw)
        sw.add(view)

        app.add_window(win)

        view.open_document("/opt/orig.odt", "{}", None, None, None)
        win.show_all()
Beispiel #29
0
    def __init__(self, conf):
        self.conf = conf

        # Entries for basic Configuration attributes
        self.pattern = Gtk.Entry()
        self.pattern.set_text(self.conf.target_pattern)

        # create tool bar and buttons
        header = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        header.pack_start(Gtk.Label(label="Target Pattern"), False, False, 10)
        header.pack_start(self.pattern, True, True, 0)
        header.pack_end(
            create_button("document-save", self.do_backup,
                          "Create Backup of Selected Directories"), False,
            False, 0)
        header.pack_end(
            create_button("view-refresh", self.do_refresh,
                          "Refresh Include State"), False, False, 0)
        header.pack_end(
            create_button("list-remove", self.do_remove, "Remove Directory"),
            False, False, 0)
        header.pack_end(
            create_button("list-add", self.do_add, "Add Directory"), False,
            False, 0)

        # create table model and body section with table view
        self.create_table()
        table_scroller = Gtk.ScrolledWindow()
        table_scroller.add(self.table)

        # progress of the current backup operation
        self.progress = Gtk.ProgressBar()
        self.progress.set_show_text(True)
        self.progress.set_text("")

        self.widgets = [self.table, *header.get_children()]

        # main vertical "box" for all the contents of the window
        body = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        body.pack_start(header, False, False, 0)
        body.pack_start(table_scroller, True, True, 0)
        body.pack_end(self.progress, False, False, 0)

        # put it all together in a window
        self.window = Gtk.ApplicationWindow(title="Simple Backup Tool")
        self.window.resize(800, 400)
        self.window.connect("delete-event", lambda *_: self.update_conf())
        self.window.connect("destroy", Gtk.main_quit)
        self.window.add(body)
        self.window.show_all()
Beispiel #30
0
    def do_activate(self):
        self.timedata = []
        self.window = Gtk.ApplicationWindow(application=self)
        self.window.connect("destroy", self.quit_callback)
        titlebar = self.create_titlebar()
        self.window.set_titlebar(titlebar)

        mainbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.window.add(mainbox)

        mainbox2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        mainbox.pack_start(mainbox2, True, True, 0)

        timevaluebox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        mainbox2.pack_start(timevaluebox, True, True, 0)

        timeline = self.create_timeline()
        timevaluebox.pack_start(timeline, True, True, 0)

        valuebox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        timevaluebox.add(valuebox)
        self.samples = Gtk.Label(label="--")
        valuebox.pack_start(self.samples, True, True, 0)
        self.voltage = Gtk.Label(label="--")
        valuebox.pack_start(self.voltage, True, True, 0)
        self.ampere = Gtk.Label(label="--")
        valuebox.pack_start(self.ampere, True, True, 0)
        self.capacity = Gtk.Label(label="--")
        valuebox.pack_start(self.capacity, True, True, 0)
        self.time = Gtk.Label(label="--")
        valuebox.pack_start(self.time, True, True, 0)
        self.stat = Gtk.Label(label="--")
        valuebox.pack_start(self.stat, True, True, 0)

        buttonbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        mainbox.add(buttonbox)
        btn_resetmAh = Gtk.Button.new_with_label("Reset mAh")
        btn_resetmAh.connect("clicked", self.btn_resetmAh)
        buttonbox.pack_start(btn_resetmAh, True, True, 0)
        btn_resetWh = Gtk.Button.new_with_label("Reset Wh")
        btn_resetWh.connect("clicked", self.btn_resetWh)
        buttonbox.pack_start(btn_resetWh, True, True, 0)
        btn_resettime = Gtk.Button.new_with_label("Reset Time")
        btn_resettime.connect("clicked", self.btn_resettime)
        buttonbox.pack_start(btn_resettime, True, True, 0)
        btn_resetall = Gtk.Button.new_with_label("Reset All")
        btn_resetall.connect("clicked", self.btn_resetall)
        buttonbox.pack_start(btn_resetall, True, True, 0)

        self.window.show_all()