Example #1
0
    def __init__(self):
        Gtk.Window.__init__(self, title="Clipboard Example")

        table = Gtk.Table(2, 2)

        self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
        self.entry = Gtk.Entry()
        self.image = Gtk.Image.new_from_icon_name("process-stop",
                                                  Gtk.IconSize.MENU)

        button_acept_text = Gtk.Button("Aceptar")
        button_cancel_text = Gtk.Button("Cancelar")
        button_close_text = Gtk.Button("Cerrar")
        #button_copy_image = Gtk.Button("Copy Image")
        #button_paste_image = Gtk.Button("Paste Image")

        table.attach(self.entry, 0, 4, 0, 1)
        #table.attach(self.image, 0, 1, 0, 2)
        table.attach(button_acept_text, 1, 2, 1, 2)
        table.attach(button_cancel_text, 2, 3, 1, 2)
        table.attach(button_close_text, 3, 1, 1, 2)
        #table.attach(button_copy_image, 1, 2, 1, 2)
        #table.attach(button_paste_image, 2, 3, 1, 2)

        button_acept_text.connect("clicked", self.copy_text)
        button_cancel_text.connect("clicked", self.paste_text)
        button_close_text.connect("clicked", self.paste_text)
        #button_copy_image.connect("clicked", self.copy_image)
        #button_paste_image.connect("clicked", self.paste_image)

        self.add(table)
Example #2
0
    def __init__(self):
        Gtk.Window.__init__(self, title="PDF Split")
        self.set_size_request(200, 100)
        self.set_border_width(10)

        self.timeout_id = None

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

        self.entry = Gtk.Entry()
        self.entry.set_text("Entra la ruta del archivo")
        vbox.pack_start(self.entry, True, True, 0)

        hbox = Gtk.Box(spacing=6)
        self.add(hbox)

        button = Gtk.Button.new_with_label("Click Me")
        button.connect("clicked", self.on_click_me_clicked)
        hbox.pack_start(button, True, True, 0)

        button = Gtk.Button.new_with_mnemonic("_Open")
        button.connect("clicked", self.on_open_clicked)
        hbox.pack_start(button, True, True, 0)

        button = Gtk.Button.new_with_mnemonic("_Close")
        button.connect("clicked", self.on_close_clicked)
        hbox.pack_start(button, True, True, 0)
Example #3
0
    def __init__(self, config, input_mods, _mstdout, mstderr):
        try:
            topic_continuum_set = TopicContinuumSet(input_mods, config)
        except RMTException as rmte:
            mstderr.write(
                "+++ ERROR: Problem reading in the continuum [%s]\n" % rmte)
            return

        self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        self.window.set_title("rmtoo - Read only GUI")
        self.window.set_default_size(800, 600)

        # create a vpaned widget and add it to our toplevel window
        hpaned = Gtk.HPaned()
        self.window.add(hpaned)
        hpaned.set_position(200)
        hpaned.show()

        # Now create the contents of the two halves of the window
        tree = self.create_tree(topic_continuum_set)
        hpaned.add1(tree)
        tree.show()

        text = self.create_text()
        hpaned.add2(text)
        text.show()

        self.window.show()
Example #4
0
 def run(self):
     self.show_all()
     Gtk.main()
     result = self.dialog.get_filename()
     self.dialog.destroy()
     self.destroy()
     return result
Example #5
0
 def create_text(self):
     view = Gtk.TextView()
     buffer = view.get_buffer()
     scrolled_window = Gtk.ScrolledWindow()
     scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                Gtk.PolicyType.AUTOMATIC)
     scrolled_window.add(view)
     self.insert_text(buffer)
     scrolled_window.show_all()
     return scrolled_window
Example #6
0
    def newPatWin(self, widget):
        """
        """
        self.patGrid = Gtk.Grid()  # Grid Layout Container
        self.homeGrid.add(self.patGrid)
        patGrid.props.valign = Gtk.Align.CENTER
        patGrid.props.halign = Gtk.Align.CENTER

        self.firstNameLabel = Gtk.Label("First Name: ")
        self.firstNameEntry = Gtk.Entry()

        patGrid.attach(self.firstNameLabel, 1, 1, 2, 2)
        patGrid.attach_next_to(self.firstNameEntry, self.firstNameLabel, 1, 2,
                               2)  #left=0, r=1, t=2, b=3
def main():

    indicator = Indicator()
    notify.init(indicator.app)
    ## keybinding
    keystr = "<Ctrl>bracketleft"
    ## keystr = "<Ctrl>l"
    kbd.init()
    kbd.bind(keystr, indicator.switch_state)

    ## dynamic indicator
    GObject.threads_init()
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    subprocess.call(["xbindkeys", "-p"])
    gtk.main()  ## start an endless loop till quit
Example #8
0
    def test_instance_to_rest(self):
        from pgi.repository import Gtk

        def itr(gprop):
            return instance_to_rest(gprop.value_type.pytype,
                                    gprop.default_value)

        v = instance_to_rest(Gtk.AccelFlags, Gtk.AccelFlags.LOCKED)
        self.assertEqual(
            v, ":obj:`Gtk.AccelFlags.LOCKED` | :obj:`Gtk.AccelFlags.MASK`")

        v = instance_to_rest(int, 42L)
        self.assertEqual(v, "``42``")

        v = instance_to_rest(Gtk.Button, None)
        self.assertEqual(v, ":obj:`None`")

        v = itr(Gtk.Widget.props.no_show_all)
        self.assertEqual(v, ":obj:`False`")

        v = instance_to_rest(Gtk.ImageType,
                             Gtk.ImageType(int(Gtk.ImageType.EMPTY)))
        self.assertEqual(v, ":obj:`Gtk.ImageType.EMPTY`")

        v = itr(Gtk.AboutDialog.props.program_name)
        self.assertEqual(v, ":obj:`None`")

        v = itr(Gtk.IMContext.props.input_hints)
        self.assertEqual(v, ":obj:`Gtk.InputHints.NONE`")

        v = itr(Gtk.CellRendererAccel.props.accel_mods)
        self.assertEqual(v, "``0``")
Example #9
0
def choose_file(button):
    dialog = Gtk.FileChooserDialog("Пожалуйста, выберите файл", win,
                                   Gtk.FileChooserAction.OPEN,
                                   (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                    Gtk.STOCK_OPEN, Gtk.ResponseType.OK))

    train_button.set_sensitive(False)
    run_tests_button.set_sensitive(False)
    run_random_test_button.set_sensitive(False)
    plot_button.set_sensitive(False)
    param_input_grid.set_sensitive(False)
    c_entry.set_text("")
    gamma_entry.set_text("")
    split_entry.set_text("")
    classes_entry.set_text("")
    # config_combo.set_sensitive(False)
    results_label.set_text("")
    test_signal_plot.clear()
    test_result_image.clear()
    set_image(all_data_plot, "data/plot_data.png", 640, 480)

    response = dialog.run()
    if (response == Gtk.ResponseType.OK):
        d.data_file_location = dialog.get_filename()
        param_input_grid.set_sensitive(True)
        # config_combo.set_sensitive(True)
    dialog.destroy()
Example #10
0
 def __init__(self, *args, **kwargs):
     Gtk.Window.__init__(self, *args, **kwargs)
     self.set_default_size(800, 600)
     scroll = Gtk.ScrolledWindow()
     self._view = view = WebKit.WebView()
     scroll.add(view)
     self.add(scroll)
Example #11
0
    def test_pprint_class(self):
        # populate cache
        Gtk.Window()

        file_ = StringIO()
        pprint(Gtk.Window, file_)
        docstring = "Gtk.Window(type: Gtk.WindowType) -> Gtk.Window"
        self.assertTrue(docstring in file_.getvalue())
Example #12
0
 def on_newPatButton_clicked(self, widget):
     """
     """
     #newPatWin = NewPatientWindow()
     #newPatWin.show_all()
     print("New Patient Window")
     self.labelGrid.remove(self.homePageLabel)
     self.fakeButton = Gtk.Button("TESTING")
     self.labelGrid.add(self.fakeButton)
Example #13
0
File: main.py Project: lazka/pypui
    def start(self):
        assert self._path

        # inject js api
        cur_dir = os.path.dirname(os.path.realpath(__file__))
        with open(os.path.join(cur_dir, "api.js"), "rb") as h:
            self._window.execute_script(h.read())

        # register our functions
        for name in self._commands.keys():
            self._window.execute_script("PYPUI._register_function('%s');" % name)

        # load page
        self._window.load_path(self._path)

        # go go go
        self._window.show_all()
        Gtk.main()
    def __init__(self):
        Gtk.Window.__init__(self, title="Home Window")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        # FIGURE OUT MENUBAR STUFF...
        # mb = Gtk.MenuBar(Gtk.Window)
        #
        # homeMenuBar = Gtk.Menu()
        # fileMenu = Gtk.MenuItem("_File")
        # fileMenu.set_submenu(homeMenuBar)

        #newPatMenuBar = Gtk.MenuItem("New Patient")
        #homeMenuBar.append(newPatMenuBar)
        #fileMenu.append(newPatMenuBar)

        #openMenuBar = Gtk.MenuItem("Open...")
        #homeMenuBar.append(openMenuBar)
        #fileMenu.append(openMenuBar)

        #endSeshMenuBar = Gtk.MenuItem("End Session")
        #homeMenuBar.append(endSeshMenuBar)
        #fileMenu.append(endSeshMenuBar)

        # mb.append(fileMenu)

        #Gtk.Application.set_menubar(self, Gtk.MenuBar)

        box = Gtk.Box(spacing=6)  # Box Layout Container
        self.add(box)
        # self.box.pack_start(menubar, True,True,0)

        aboutBox = Gtk.AboutDialog()
        #gtk_show_about_dialog()

        self.testButton = Gtk.Button(label="Click Here")
        self.testButton.connect("clicked", self.on_testButton_clicked)
        box.pack_start(self.testButton, True, True, 0)

        self.newPatButton = Gtk.Button(label="New Patient")
        self.newPatButton.connect("clicked", self.on_newPatButton_clicked)
        #self.newPatButton.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(6400,6400,6440))
        box.pack_start(self.newPatButton, True, True, 0)
    def __init__(self):
        Gtk.Window.__init__(self, title="InitialWindow")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        initGrid = Gtk.Grid()
        self.add(initGrid)

        momDisp = Gtk.Box()
        initGrid.add(momDisp)

        self.beginButton = Gtk.Button(label="Begin")
        self.beginButton.connect("clicked", self.on_beginButton_clicked)
        initGrid.add(self.beginButton)

        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
            "pelvisim.png", 100, 100, True)
        pelvIm = Gtk.Image.new_from_pixbuf(pixbuf)
        initGrid.add(pelvIm)
    def __init__(self):
        Gtk.Window.__init__(self, title="Home Window")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        # FIGURE OUT MENUBAR STUFF...
        #menubar = Gtk.MenuBar
        #Gtk.Application.set_menubar(self, Gtk.MenuBar)

        self.box = Gtk.Box(spacing=6)  # Box Layout Container
        self.add(self.box)
        # self.box.pack_start(menubar, True,True,0)

        self.testButton = Gtk.Button(label="Click Here")
        self.testButton.connect("clicked", self.on_testButton_clicked)
        self.box.pack_start(self.testButton, True, True, 0)

        self.newPatButton = Gtk.Button(label="New Patient")
        self.newPatButton.connect("clicked", self.on_newPatButton_clicked)
        self.box.pack_start(self.newPatButton, True, True, 0)
    def build_menu(self):
        menu = gtk.Menu()

        item_activate = gtk.MenuItem('Activate')
        item_activate.connect('activate', self.activate)
        menu.append(item_activate)

        item_deactivate = gtk.MenuItem('Deactivate')
        item_deactivate.connect('activate', self.deactivate)
        menu.append(item_deactivate)

        menu_sep = gtk.SeparatorMenuItem()
        menu.append(menu_sep)

        item_quit = gtk.MenuItem('Quit')
        item_quit.connect('activate', self.quit)
        menu.append(item_quit)

        menu.show_all()
        return menu
    def __init__(self):
        Gtk.Window.__init__(self, title="New Patient Window")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        patGrid = Gtk.Grid()  # Grid Layout Container
        self.add(patGrid)
        patGrid.props.valign = Gtk.Align.CENTER
        patGrid.props.halign = Gtk.Align.CENTER

        self.firstNameLabel = Gtk.Label("First Name: ")
        self.firstNameEntry = Gtk.Entry()

        patGrid.attach(self.firstNameLabel, 1, 1, 2, 2)
        patGrid.attach_next_to(self.firstNameEntry, self.firstNameLabel, 1, 2,
                               2)  #left=0, r=1, t=2, b=3

        self.lastNameLabel = Gtk.Label("Last Name: ")
        self.lastNameEntry = Gtk.Entry()

        patGrid.attach_next_to(self.lastNameLabel, self.firstNameLabel, 3, 2,
                               2)
        patGrid.attach_next_to(self.lastNameEntry, self.lastNameLabel, 1, 2, 2)

        self.submitButton = Gtk.Button(label="Submit")
        self.submitButton.connect("clicked", self.on_submitButton_clicked)
        patGrid.attach_next_to(self.submitButton, self.lastNameLabel, 3, 4, 2)
Example #19
0
    def test_named_tuple_return(self):
        from gi.repository import Gtk
        b = Gtk.Button()
        b.set_alignment(0.0, 1.0)
        align = b.get_alignment()

        # access by name
        self.assertEqual(len(align), 2)
        self.assertEqual(align[0], align.xalign)
        self.assertEqual(align[1], align.yalign)

        # repr
        self.assertEqual(repr(align), "(xalign=0.0, yalign=1.0)")

        # pickle as tuple
        obj = pickle.dumps(align)
        self.assertEqual(pickle.loads(obj), (0.0, 1.0))
Example #20
0
    def homeWindow(self, widget):
        """
        """
        self.homeGrid = Gtk.Grid()  # VBox container for label and for buttons
        self.add(self.homeGrid)

        self.labelGrid = Gtk.Grid()  # Grid for label container
        self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE")

        self.labelGrid.add(self.homePageLabel)
        self.homeGrid.add(self.labelGrid)

        self.labelGrid.props.halign = Gtk.Align.CENTER  # Align center
        self.labelGrid.props.valign = Gtk.Align.END  # Align Center

        homeButtonGrid = Gtk.Grid()  # Grid layout container for buttons
        self.homeGrid.add(homeButtonGrid)  # Add to Vbox container

        homeButtonGrid.props.halign = Gtk.Align.CENTER  # Align center
        homeButtonGrid.props.valign = Gtk.Align.END  # Align botton

        self.openButton = Gtk.Button(
            "Open..."
        )  # Open button... will lead to file selector for past patient files
        self.openButton.connect(
            "clicked", self.on_openButton_clicked)  # Open button action...
        homeButtonGrid.attach(self.openButton, 1, 1, 2,
                              2)  # Open button's layout

        self.newPatButton = Gtk.Button(
            "New Patient"
        )  # New patient button leads to new patient window screen
        self.newPatButton.connect(
            "clicked",
            self.on_newPatButton_clicked)  # New patient button action...
        homeButtonGrid.attach_next_to(self.newPatButton, self.openButton, 1, 2,
                                      2)  #left=0, r=1, t=2, b=3

        self.backButton = Gtk.Button("Back")  # Back button
        self.backButton.connect(
            "clicked", self.on_backButton_clicked)  # Back button action
        homeButtonGrid.attach_next_to(self.backButton, self.newPatButton, 1, 1,
                                      1)  # Back button layout
    def homeWindow(self, widget):
        """
        """
        #self.mainGrid = Gtk.Grid()
        #self.add(self.mainGrid)
        self.mainBox = Gtk.VBox()
        self.add(self.mainBox)

        self.labelGrid = Gtk.Grid()
        self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE")

        self.labelGrid.attach(self.homePageLabel, 1, 1, 2, 2)
        self.mainBox.add(self.labelGrid)

        self.labelGrid.props.valign = Gtk.Align.CENTER
        self.labelGrid.props.halign = Gtk.Align.CENTER

        # ADDING AND REMOVING SUB GRID WORKS:
        #self.mainBox.remove(self.labelGrid)
        #self.mainBox.add(self.labelGrid)

        self.homeButtonGrid = Gtk.Grid()
        self.mainBox.add(self.homeButtonGrid)

        self.homeButtonGrid.props.halign = Gtk.Align.CENTER
        self.homeButtonGrid.props.valign = Gtk.Align.END

        self.openButton = Gtk.Button("Open...")
        self.openButton.connect("clicked", self.on_openButton_clicked)
        self.homeButtonGrid.attach(self.openButton, 1, 1, 2, 2)

        self.newPatButton = Gtk.Button("New Patient")
        self.newPatButton.connect("clicked", self.on_newPatButton_clicked)
        self.homeButtonGrid.attach_next_to(self.newPatButton, self.openButton,
                                           1, 2, 2)  #left=0, r=1, t=2, b=3

        self.backButton = Gtk.Button("Back")
        self.backButton.connect("clicked", self.on_backButton_clicked)
        self.homeButtonGrid.attach_next_to(self.backButton, self.newPatButton,
                                           1, 1, 1)
    def __init__(self):
        Gtk.Window.__init__(self, title="Home Window")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        #TODO: FIGURE OUT WINDOW STUFF

        self.homeVBox = Gtk.VBox()
        self.add(self.homeVBox)

        self.labelBox = Gtk.Box()
        self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE")

        self.labelBox.add(self.homePageLabel)
        self.homeVBox.add(self.labelBox)

        self.labelBox.props.halign = Gtk.Align.CENTER
        self.labelBox.props.valign = Gtk.Align.END

        homeButtonGrid = Gtk.Grid()  # Grid Layout Container
        self.homeVBox.add(homeButtonGrid)

        homeButtonGrid.props.halign = Gtk.Align.CENTER
        homeButtonGrid.props.valign = Gtk.Align.END
        # self.box.pack_start(menubar, True,True,0)

        self.openButton = Gtk.Button("Open...")
        self.openButton.connect("clicked", self.on_openButton_clicked)
        homeButtonGrid.attach(self.openButton, 1, 1, 2, 2)

        self.newPatButton = Gtk.Button("New Patient")
        self.newPatButton.connect("clicked", self.on_newPatButton_clicked)
        homeButtonGrid.attach_next_to(self.newPatButton, self.openButton, 1, 2,
                                      2)  #left=0, r=1, t=2, b=3

        self.backButton = Gtk.Button("Back")
        self.backButton.connect("clicked", self.on_backButton_clicked)
        homeButtonGrid.attach_next_to(self.backButton, self.newPatButton, 1, 1,
                                      1)
    def __init__(self):
        Gtk.Window.__init__(self, title="New Patient Window")
        Gtk.Window.set_default_size(self, window_w,
                                    window_h)  # Set Default Window Size

        self.grid = Gtk.Grid()  # Grid Layout Container
        self.add(self.grid)

        self.firstNameLabel = Gtk.Label("First Name: ")
        self.firstNameEntry = Gtk.Entry()

        self.grid.add(self.firstNameLabel)
        self.grid.add(self.firstNameEntry)

        self.lastNameLabel = Gtk.Label("Last Name: ")
        self.lastNameEntry = Gtk.Entry()

        self.grid.add(self.lastNameLabel)
        self.grid.add(self.lastNameEntry)

        self.submitButton = Gtk.Button(label="Submit")
        self.submitButton.connect("clicked", self.on_submitButton_clicked)
        self.grid.add(self.submitButton)
Example #24
0
def set_parameters(button):
    if (c_entry.get_text_length()       == 0 and \
     gamma_entry.get_text_length()   == 0 and \
     split_entry.get_text_length()   == 0 and \
     classes_entry.get_text_length() == 0):
        c_entry.set_text("3")
        gamma_entry.set_text("0.02")
        split_entry.set_text("0.35")
        classes_entry.set_text("0,1,4,5,6")
    msg_dialog = Gtk.MessageDialog(
        win, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK,
        "Параметры RBF должны соответствовать " +
        "следующим ограничениям:\n\tC > 0\n\t" +
        "0 < gamma < 1\n\t0 < split < 1\n\t" + "Классы: от 0 до 9 через \",\"")
    test_signal_plot.clear()
    test_result_image.clear()
    set_image(all_data_plot, "data/plot_data.png", 640, 480)

    def verify_classes_entry(c):
        try:
            d.classes = [int(x) for x in c.split(",")]
        except:
            return False
        for i in d.classes:
            if i > 9 or i < 0:
                return False
        return True

    try:
        d.c = float(c_entry.get_text())
        d.gamma = float(gamma_entry.get_text())
        d.split = float(split_entry.get_text())

        if (d.split > 0. and d.split < 1.\
         and d.gamma > 0. and d.gamma < 1. and d.c > 0. \
         and verify_classes_entry(classes_entry.get_text())):

            is_data_processed = d.init_data_acquisition()
            if (is_data_processed == True):
                train_button.set_sensitive(True)
                plot_button.set_sensitive(True)
                run_tests_button.set_sensitive(False)
                run_random_test_button.set_sensitive(False)
                results_label.set_text("")
                s.init_model(d.c, d.gamma)
            elif (is_data_processed == "data_not_organised"):
                train_button.set_sensitive(False)
                run_tests_button.set_sensitive(False)
                run_random_test_button.set_sensitive(False)
                plot_button.set_sensitive(False)
                param_input_grid.set_sensitive(False)
                # config_combo.set_sensitive(False)
                results_label.set_text("")
                set_image(all_data_plot, "data/plot_data.png", 640, 480)

                msg_dialog = Gtk.MessageDialog(
                    win, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK,
                    "Данные в файле организованы неправильно")
                msg_dialog.run()
                msg_dialog.destroy()
        else:
            train_button.set_sensitive(False)
            plot_button.set_sensitive(False)
            run_tests_button.set_sensitive(False)
            run_random_test_button.set_sensitive(False)
            results_label.set_text("")
            msg_dialog.run()
            msg_dialog.destroy()

    except ValueError:
        msg_dialog.run()
        msg_dialog.destroy()
Example #25
0
 def on_file_clicked(self, widget):
     self.add_filters(self.dialog)
     self.dialog.run()
     Gtk.main_quit()
Example #26
0
        self.entry.set_visibility(value)

    def on_pulse_toggled(self, button):
        if button.get_active():
            self.entry.set_progress_pulse_step(0.2)
            # Call self.do_pulse every 100 ms
            self.timeout_id = GLib.timeout_add(100, self.do_pulse, None)
        else:
            # Don't call self.do_pulse anymore
            GLib.source_remove(self.timeout_id)
            self.timeout_id = None
            self.entry.set_progress_pulse_step(0)

    def do_pulse(self, user_data):
        self.entry.progress_pulse()
        return True

    def on_icon_toggled(self, button):
        if button.get_active():
            icon_name = "system-search-symbolic"
        else:
            icon_name = None
        self.entry.set_icon_from_icon_name(Gtk.EntryIconPosition.PRIMARY,
                                           icon_name)


win = EntryWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()
Example #27
0
    def __init__(self):
        Gtk.Window.__init__(self, title="Separate PDF")

        self.button = Gtk.Button(label="Start")
        self.button.connect("clicked", self.on_button_clicked)
        self.add(self.button)
Example #28
0
 def on_ok_button_clicked(button):
     Gtk.main_quit()
Example #29
0
 def main(self):
     Gtk.main()
Example #30
0
 def run(self):
     self.show_all()
     Gtk.main()
     result = self.entry.get_text()
     self.destroy()
     return result
Example #31
0
    def create_tree(self, topic_continuum_set):
        # Create a new scrolled window, with scrollbars only if needed
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)

        rmtoo_model = RmtooTreeModel(topic_continuum_set)

        #        tree_view = Gtk.TreeView()
        #        scrolled_window.add_with_viewport (tree_view)
        #        tree_view.show()
        #
        #        selection = tree_view.get_selection()
        #        selection.connect('changed', self.on_selection_changed)

        # create the TreeView
        self.treeview = Gtk.TreeView()

        # create the TreeViewColumns to display the data
        column_names = rmtoo_model.get_column_names()
        self.tvcolumn = [None] * len(column_names)
        #        cellpb = Gtk.CellRendererPixbuf()
        #        self.tvcolumn[0] = Gtk.TreeViewColumn(column_names[0],
        #                                              cellpb, pixbuf=0)
        #        cell = Gtk.CellRendererText()
        #        self.tvcolumn[0].pack_start(cell, False)
        #        self.tvcolumn[0].add_attribute(cell, 'text', 1)
        #        self.treeview.append_column(self.tvcolumn[0])
        for n in range(0, len(column_names)):
            cell = Gtk.CellRendererText()
            #            if n == 0:
            #                cell.set_property('xalign', 1.0)
            self.tvcolumn[n] = Gtk.TreeViewColumn(column_names[n],
                                                  cell,
                                                  text=n)
            self.treeview.append_column(self.tvcolumn[n])

        scrolled_window.add_with_viewport(self.treeview)
        self.treeview.set_model(rmtoo_model)
        self.treeview.show()

        #        for name, continuum in iteritem(
        #                 topic_continuum_set.get_continuum_dict()):
        #            iter_continuum = model.append(None)
        #            model.set(iter_continuum, 0, name)
        #            for commit_id in continuum.get_vcs_commit_ids():
        #                iter_commit = model.append(iter_continuum)
        #                model.set(iter_commit, 0, commit_id)
        #                topic_set = continuum.get_topic_set(commit_id.get_commit())
        #                req_set = topic_set.get_requirement_set()
        #
        #                req_set.find_master_nodes()
        #                for master_node in req_set.get_master_nodes():
        #                    self.__add_requirements(model, iter_commit, master_node)
        #
        #
        #        cell = Gtk.CellRendererText()
        #        column = Gtk.TreeViewColumn("Requirements", cell, text=0)
        #        tree_view.append_column(column)

        return scrolled_window
Example #32
0
# version 2.1 of the License, or (at your option) any later version.

import sys
sys.path.insert(0, '../..')
import pgi
pgi.install_as_gi()

from pgi.repository import WebKit, Gtk


class WebWindow(Gtk.Window):
    def __init__(self, *args, **kwargs):
        Gtk.Window.__init__(self, *args, **kwargs)
        self.set_default_size(800, 600)
        scroll = Gtk.ScrolledWindow()
        self._view = view = WebKit.WebView()
        scroll.add(view)
        self.add(scroll)

    def load_url(self, url):
        self._view.open(url)


if __name__ == "__main__":
    window = WebWindow()
    window.set_title("App")
    window.load_url("http://www.google.com")
    window.connect("delete-event", Gtk.main_quit)
    window.show_all()
    Gtk.main()
Example #33
0
File: main.py Project: lazka/pypui
 def quit(self):
     Gtk.main_quit()
Example #34
0
                msg_dialog.destroy()
        else:
            train_button.set_sensitive(False)
            plot_button.set_sensitive(False)
            run_tests_button.set_sensitive(False)
            run_random_test_button.set_sensitive(False)
            results_label.set_text("")
            msg_dialog.run()
            msg_dialog.destroy()

    except ValueError:
        msg_dialog.run()
        msg_dialog.destroy()


win = Gtk.Window()
win.set_position(Gtk.WindowPosition.CENTER)
win.set_title("Классификация сигналов ЭМГ")
win.set_default_size(p.main_window_width, p.main_window_height)
win.timeout_id = None
win.connect("delete-event", Gtk.main_quit)

file_chooser_button = Gtk.Button("Выбрать файл")
file_chooser_button.connect("clicked", choose_file)

# configs = {'100% - 0,1,3':      [1, 0.07, 0.47, "0,1,3"],
# 		   '94.94% - 0,1,4,5,6':[2, 0.02, 0.35, "0,1,4,5,6"],
# 		   '96.50% - 0,1,3,4,5':[2, 0.04, 0.64, "0,1,3,4,5"]}
# config_combo = Gtk.ComboBoxText()
# config_combo.set_entry_text_column(0)
# config_combo.connect("changed", on_config_combo_changed)
Example #35
0
 def main(self):
     Gtk.main()
 def quit(self, source):
     self.deactivate()
     gtk.main_quit()
Example #37
0
import pgi
pgi.require_version('Gtk', '3.0')
from pgi.repository import Gtk

window = Gtk.Window()
entry = Gtk.Entry()
button_ok = Gtk.Button("OK")
button_cancel = Gtk.Button("Cancel")
vbox = Gtk.VBox()
vbox.pack_start(entry)
hbox = Gtk.HBox()
hbox.pack_start(button_ok)
hbox.pack_start(button_cancel)
vbox.pack_start(hbox)
window.add(vbox)
window.show_all()