Exemplo n.º 1
0
    def __init__(self):
        gtk.VBox.__init__(self)

        self._notebook = gtk.Notebook()
        self._notebook.set_tab_pos(gtk.POS_BOTTOM)
        self._notebook.set_show_border(False)
        self._notebook.set_show_tabs(False)
        self._notebook.props.tab_vborder = style.TOOLBOX_TAB_VBORDER
        self._notebook.props.tab_hborder = style.TOOLBOX_TAB_HBORDER
        self.pack_start(self._notebook)
        self._notebook.show()

        self._separator = gtk.HSeparator()
        self._separator.modify_bg(gtk.STATE_NORMAL,
                                  style.COLOR_PANEL_GREY.get_gdk_color())
        self._separator.set_size_request(1, style.TOOLBOX_SEPARATOR_HEIGHT)
        self.pack_start(self._separator, False)

        self._notebook.connect('notify::page', self._notify_page_cb)
Exemplo n.º 2
0
 def set_slide_index(self, index):
     '''
     set slide to index
     @param index: the index of widget in slider, an int num
     '''
     if index >= len(self.slider_list):
         return
     direct = "right"
     if index == 1 and self.window.button_box in self.window.window_frame.get_children():
         #self.slider.set_size_request(-1, 260)
         win = self.window
         if win.left_button_box in win.button_box.get_children():
             win.button_box.remove(win.left_button_box)
         if win.right_button_box in win.button_box.get_children():
             win.button_box.remove(win.right_button_box)
         tmp = gtk.HSeparator()
         tmp.set_size_request(-1, 1)
         tmp.show()
         win.button_box.pack_start(tmp)
         direct = "right"
         #if self.window.button_box in self.window.window_frame.get_children():
             #self.window.window_frame.remove(self.window.button_box)
     elif index == 0:
         #self.slider.set_size_request(-1, 223)
         win = self.window
         for each in win.button_box.get_children():
             each.destroy()
         if win.left_button_box not in win.button_box.get_children():
             win.button_box.pack_start(win.left_button_box)
         if win.right_button_box not in win.button_box.get_children():
             win.button_box.pack_start(win.right_button_box)
         direct = "left"
         #if self.window.button_box not in self.window.window_frame.get_children():
             #self.window.window_frame.pack_start(self.window.button_box, False, False)
     elif index == 2:
         self.window.left_button_box.set_buttons([])
         l = Label("  ")
         l.show()
         self.window.right_button_box.set_buttons([l])
         direct = "right"
         #self.slider.set_size_request(-1, 223)
         
     self.slider.slide_to_page(self.slider_list[index], direct)
Exemplo n.º 3
0
    def create_progress_bar(self, window):
        window.set_position(gtk.WIN_POS_CENTER)
        window.set_resizable(True)

        window.set_title("Scanning Crossword Files")
        window.set_border_width(0)

        vbox = gtk.VBox(False, 5)
        vbox.set_border_width(10)
        window.add(vbox)
        vbox.show()
  
        # Create the ProgressBar
        pbar = gtk.ProgressBar()
        pbar.set_size_request(300, -1)
        vbox.pack_start(pbar, False, False, 5)
        pbar.show()

        separator = gtk.HSeparator()
        vbox.pack_start(separator, False, False, 0)
        separator.show()

        # Create a centering alignment object
        align = gtk.Alignment(0.5, 0.5, 0, 0)
        vbox.pack_start(align, False, False, 5)
        
        # Add a button to exit the program
        button = gtk.Button("Cancel")
        button.connect_object("clicked", gtk.Widget.destroy, window)
        align.add(button)
        align.show()

        # This makes it so the button is the default.
        button.set_flags(gtk.CAN_DEFAULT)

        # This grabs this button to be the default button. Simply hitting
        # the "Enter" key will cause this button to activate.
        button.grab_default()
        button.show()

        window.show()
        
        return pbar
Exemplo n.º 4
0
 def buildGUI(self):
     debug.mainthreadTest()
     self.table.resize(rows=4, columns=2)
     row = 4
     self.plugins = []
     for pluginclass in pixelinfoplugin.plugInClasses:
         self.table.resize(row + 1 + pluginclass.nrows, 2)
         # A gtk or pygtk bug requires xpadding to be set
         # explicitly if ypadding is set here.
         self.table.attach(gtk.HSeparator(),
                           0,
                           2,
                           row,
                           row + 1,
                           xoptions=gtk.EXPAND | gtk.FILL,
                           xpadding=0,
                           ypadding=3)
         self.plugins.append(pluginclass(self, self.table, row + 1))
         row += pluginclass.nrows + 1
Exemplo n.º 5
0
    def __init__(self, d, data):
        import pygtk
        pygtk.require("2.0")
        import gtk

        win = gtk.Window()
        win.connect("delete_event", self.on_delete)
        win.set_title("Select by name")

        self.diagram = d
        self.data = data
        self.win = win

        box1 = gtk.VBox()
        win.add(box1)
        box1.show()

        box2 = gtk.VBox(spacing=10)
        box2.set_border_width(10)
        box1.pack_start(box2)
        box2.show()

        self.entry = gtk.Entry()
        self.entry.set_text("enter name")
        box2.pack_start(self.entry)
        self.entry.show()

        separator = gtk.HSeparator()
        box1.pack_start(separator, expand=0)
        separator.show()

        box2 = gtk.VBox(spacing=10)
        box2.set_border_width(10)
        box1.pack_start(box2, expand=0)
        box2.show()

        button = gtk.Button("find")
        button.connect("clicked", self.on_find)
        box2.pack_start(button)
        button.set_flags(gtk.CAN_DEFAULT)
        button.grab_default()
        button.show()
        win.show()
Exemplo n.º 6
0
    def __init__(self, window, parent, model, attrs={}):
        interface.widget_interface.__init__(self, window, parent, model, attrs)

        self.widget = gtk.VBox(homogeneous=False, spacing=1)

        hb = gtk.HBox(homogeneous=False, spacing=3)
        self.wid_text = gtk.Entry()
        self.wid_text.set_property('width_chars', 13)
        self.wid_text.connect('activate', self._sig_activate)
        self.wid_text.connect('button_press_event', self._menu_open)
        hb.pack_start(self.wid_text, expand=True, fill=True)

        hb.pack_start(gtk.VSeparator(), padding=2, expand=False, fill=False)

        self.wid_but_add = gtk.Button(stock='gtk-add')
        self.wid_but_add.set_relief(gtk.RELIEF_HALF)
        self.wid_but_add.set_focus_on_click(True)
        self.wid_but_add.connect('clicked', self._sig_add)
        hb.pack_start(self.wid_but_add, padding=3, expand=False, fill=False)

        self.wid_but_remove = gtk.Button(stock='gtk-remove')
        self.wid_but_remove.set_relief(gtk.RELIEF_HALF)
        self.wid_but_remove.set_focus_on_click(True)
        self.wid_but_remove.connect('clicked', self._sig_remove)
        hb.pack_start(self.wid_but_remove, expand=False, fill=False)

        self.widget.pack_start(hb, expand=False, fill=False)
        self.widget.pack_start(gtk.HSeparator(), expand=False, fill=True)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_placement(gtk.CORNER_TOP_LEFT)
        scroll.set_shadow_type(gtk.SHADOW_NONE)

        self.screen = Screen(attrs['relation'],
                             view_type=['tree'],
                             views_preload=attrs.get('views', {}))
        scroll.add_with_viewport(self.screen.widget)
        self.widget.pack_start(scroll, expand=True, fill=True)

        #        self.old = None
        self.avail_ids = set()
Exemplo n.º 7
0
    def __init__(self):
        self.widgets = gtk.glade.XML('test.glade')
        self.widgets.signal_autoconnect(GladeHandlers.__dict__)

        self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
        self['windowMain'].move(10, 10)
        self.figure = Figure(figsize=(8, 6), dpi=72)
        self.axis = self.figure.add_subplot(111)

        t = arange(0.0, 3.0, 0.01)
        s = sin(2 * pi * t)
        self.axis.plot(t, s)
        self.axis.set_xlabel('time (s)')
        self.axis.set_ylabel('voltage')

        self.canvas = FigureCanvas(self.figure)  # a gtk.DrawingArea
        self.canvas.show()
        self.canvas.set_size_request(600, 400)

        def onselect(xmin, xmax):
            print xmin, xmax

        span = HorizontalSpanSelector(self.axis,
                                      onselect,
                                      useblit=False,
                                      rectprops=dict(alpha=0.5,
                                                     facecolor='red'))

        self['vboxMain'].pack_start(self.canvas, True, True)
        self['vboxMain'].show()

        # below is optional if you want the navigation toolbar
        self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
        self.navToolbar.lastDir = '/var/tmp/'
        self['vboxMain'].pack_start(self.navToolbar)
        self.navToolbar.show()

        sep = gtk.HSeparator()
        sep.show()
        self['vboxMain'].pack_start(sep, True, True)

        self['vboxMain'].reorder_child(self['buttonClickMe'], -1)
Exemplo n.º 8
0
 def __init__(self, dest, list):
     gtk.Window.__init__(self)
     self.connect('destroy', self.destr)
     self.connect('key-release-event', self.key_event)
     self.set_resizable(False)
     self.set_modal(True)
     vbox = gtk.VBox(False, 5)
     self.set_border_width(5)
     self.Exit = False
     self.Pause = False
     self.set_title(_('Delete'))
     self.set_icon(edna_function.get_theme.load_icon('gtk-clear', 20, 0))
     self.set_position(gtk.WIN_POS_CENTER)
     self.dest = dest
     self.list = list
     self.list.reverse()
     self.n = len(list) + len(dest)
     self.count = 0
     self.progress1 = gtk.ProgressBar()
     self.progress1.set_text('0')
     self.progress1.set_size_request(450, -1)
     self.label_progres = gtk.Label()
     self.label_src = gtk.Label()
     self.label_src.set_size_request(450, -1)
     tab = gtk.Table(1, 3, True)
     tab.set_col_spacings(30)
     self.butt_cen = gtk.Button(stock='gtk-cancel')
     self.butt_cen.connect('clicked', self.but_destr)
     self.butt_ps = gtk.Button(_('_Pause'))
     self.butt_ps.connect('clicked', self.restart)
     tab.attach(gtk.Label(), 0, 1, 0, 1)
     tab.attach(self.butt_cen, 1, 2, 0, 1)
     tab.attach(self.butt_ps, 2, 3, 0, 1)
     vbox.pack_start(self.label_progres)
     vbox.pack_start(gtk.HSeparator())
     vbox.pack_start(self.label_src)
     vbox.pack_start(self.progress1)
     vbox.pack_start(tab)
     self.timer = threading.Timer(0, self.copy_timer)
     self.add(vbox)
     self.show_all()
     self.timer.start()
Exemplo n.º 9
0
    def __init__(self):
        self.tcp = TcpControlFactory(self)
        self.connected = False

        w = gtk.Window(gtk.WINDOW_TOPLEVEL)
        w.set_border_width(5)
        w.resize(320, 1)

        vbox = gtk.VBox()
        vbox.pack_start(self.make_connection_settings())
        vbox.pack_start(gtk.HSeparator())
        vbox.pack_start(self.make_controls())
        w.add(vbox)
        
        w.connect("delete-event", gtk.main_quit)
        w.connect("key_press_event", self.key_press)
        self.connect_controls()
        w.show_all()

        reactor.run()
Exemplo n.º 10
0
    def add_filter(self, widget, fnct, clear_fnct, next_fnct, prev_fnct):
        self.filter_vbox = gtk.VBox(spacing=1)
        self.filter_vbox.set_border_width(1)

        self.filter_vbox.pack_start(widget, expand=True, fill=True)

        hb2 = gtk.HButtonBox()
        hb2.set_spacing(5)
        hb2.set_layout(gtk.BUTTONBOX_START)
        hb = gtk.HButtonBox()
        hb.set_spacing(5)
        hb.set_layout(gtk.BUTTONBOX_END)
        hs = gtk.HBox()
        hs.pack_start(hb2)
        hs.pack_start(hb)

        self.but_previous = gtk.Button(stock=gtk.STOCK_GO_BACK)
        self.but_previous.connect('clicked', prev_fnct)
        self.but_next = gtk.Button(stock=gtk.STOCK_GO_FORWARD)
        self.but_next.connect('clicked', next_fnct)
        hb2.pack_start(self.but_previous, expand=False, fill=False)
        hb2.pack_start(self.but_next, expand=False, fill=False)

        button_clear = gtk.Button(stock=gtk.STOCK_CLEAR)
        button_clear.connect('clicked', clear_fnct)
        hb.pack_start(button_clear, expand=False, fill=False)

        self.button = gtk.Button(stock=gtk.STOCK_FIND)
        self.button.connect('clicked', fnct)
        self.button.set_property('can_default', True)

        hb.pack_start(self.button, expand=False, fill=False)
        hb.show_all()
        hb2.show_all()

        hs.show_all()
        self.filter_vbox.pack_start(hs, expand=False, fill=False)
        hs = gtk.HSeparator()
        hs.show()
        self.filter_vbox.pack_start(hs, expand=True, fill=False)
        self.vbox.pack_start(self.filter_vbox, expand=False, fill=True)
Exemplo n.º 11
0
    def __init__(self):
        super(PropertyView, self).__init__()

        self.set_label("Properties")

        self.txpad = 0
        self.typad = 0

        self.vbox = gtk.VBox(False, 3)
        self.add(self.vbox)
        self.vbox.show()

        # Slave name.
        self.node_label = gtk.Label("No Node")
        self.node_label.show()
        self.vbox.pack_start(self.node_label,
                             expand=False,
                             fill=True,
                             padding=self.txpad)

        # Separator.
        sep = gtk.HSeparator()
        self.vbox.pack_start(sep, expand=False, fill=True, padding=0)

        self.module_pos = 0
        self.filename_pos = 1
        self.pos = 2

        # Table of parameters.
        self.table = None
        self.initialize_table()

        self.update_button = gtk.Button(label="Upate")
        self.vbox.pack_end(self.update_button,
                           expand=False,
                           fill=True,
                           padding=0)

        self.update_callback = None
        self.update_button.connect("clicked", self.on_update_click)
        self.property_dict = {}
Exemplo n.º 12
0
    def _build_side_panel(self):
        vbox = gtk.VBox(False, 3)

        button = gtk.Button(stock=gtk.STOCK_NEW)
        button.set_tooltip_text(_("Add new mission to list"))
        button.connect('clicked', self.on_new_clicked)
        vbox.pack_start(button, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_DELETE)
        button.set_tooltip_text(_("Delete selected mission from list"))
        button.connect('clicked', self.on_delete_clicked)
        vbox.pack_start(button, False, False, 0)
        self.b_delete = button

        vbox.pack_start(gtk.HSeparator(), False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_GOTO_TOP)
        button.set_tooltip_text(_("Move selected mission to top"))
        button.connect('clicked', self.on_move_to_top)
        vbox.pack_start(button, False, False, 0)
        self.b_move_to_top = button

        button = gtk.Button(stock=gtk.STOCK_GO_UP)
        button.set_tooltip_text(_("Move selected mission up"))
        button.connect('clicked', self.on_move_up)
        vbox.pack_start(button, False, False, 0)
        self.b_move_up = button

        button = gtk.Button(stock=gtk.STOCK_GO_DOWN)
        button.set_tooltip_text(_("Move selected mission down"))
        button.connect('clicked', self.on_move_down)
        vbox.pack_start(button, False, False, 0)
        self.b_move_down = button

        button = gtk.Button(stock=gtk.STOCK_GOTO_BOTTOM)
        button.set_tooltip_text(_("Move selected mission to bottom"))
        button.connect('clicked', self.on_move_to_bottom)
        vbox.pack_start(button, False, False, 0)
        self.b_move_to_bottom = button

        return vbox
Exemplo n.º 13
0
    def edit_exception(self, menuitem, entry):
        """An entry will be changed"""
        type, pos, item = entry
        if DEBUG:
            print "Editing %s [%s]:" % (item, type)
        dialog = gtk.Dialog(_("Editing exception"),
                self.window, 0,
                (gtk.STOCK_OK, gtk.RESPONSE_OK,
                gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
        dialog.set_default_size(600, -1)
        # option title
        label = gtk.Label("Exception type: %s" % type)
        dialog.vbox.pack_start(label)
        dialog.vbox.pack_start(gtk.HSeparator())

        # new acl
        hbox = gtk.HBox(spacing=5)
        label = gtk.Label(_("<b>Exception:</b>"))
        label.set_use_markup(True)
        hbox.pack_start(label, False, False)
        entry_path = gtk.Entry()
        entry_path.set_text(item)
        hbox.pack_start(entry_path)
        dialog.vbox.pack_start(hbox)

        dialog.show_all()
        response = dialog.run()
        if response != gtk.RESPONSE_OK:
            dialog.destroy()
            return

        new_item = entry_path.get_text()
        dialog.destroy()

        self.exceptions.exceptions[type][pos] = new_item

        if DEBUG:
            print "%s -> %s, %s -> %s" % (item, acl, new_item, new_acl)

        # refresh domain data
        self.update_exceptions()
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        # toolbox #
        tlbx = activity.ActivityToolbox(self)
        self.set_toolbox(tlbx)

        # top label #
        self.top_label = gtk.Label()
        self.top_label.set_line_wrap(True)
        self.top_label.set_justify(gtk.JUSTIFY_LEFT)
        self.top_label.set_property('xalign', 0)

        # bottom label #
        bottom_label = gtk.Label()
        bottom_label.set_line_wrap(True)
        bottom_label.set_justify(gtk.JUSTIFY_LEFT)
        bottom_label.set_property('xalign', 0)
        bottom_label.set_markup(
            _('Software updates correct errors, eliminate security vulnerabilities, and provide new features.'
              ))

        # main canvas #
        main_canvas = gtk.VBox()
        main_canvas.pack_start(self.top_label, expand=False)
        main_canvas.pack_start(gtk.HSeparator(), expand=False)
        main_canvas.pack_start(bottom_label, expand=True)
        self.set_canvas(main_canvas)

        # bundle pane #
        self.bundle_list = model.UpdateList()
        self.bundle_pane = BundlePane(self)
        main_canvas.pack_start(self.bundle_pane, expand=True)

        # progress pane #
        self.progress_pane = ProgressPane(self)
        main_canvas.pack_start(self.progress_pane, expand=True, fill=False)

        self.show_all()

        self.refresh_cb(None, None)
Exemplo n.º 15
0
    def __init__(self, callback, player_name, config_table):
        '''constructor, callback is a function that receives a boolean as first
        argument with the value True if ok was clicked and False otherwise,
        the rest of the arguments are the values collected during configuration
        '''
        gtk.Window.__init__(self)

        self.config_table = config_table
        self.callback = callback
        self.set_border_width(2)
        self.set_title(player_name + " preferences")
        self.set_icon(utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        self.set_default_size(300, 150)
        self.set_role("New preferences Window")
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        vbox = gtk.VBox()

        buttons = gtk.HButtonBox()
        buttons.set_layout(gtk.BUTTONBOX_END)

        accept = gtk.Button(stock=gtk.STOCK_OK)
        cancel = gtk.Button(stock=gtk.STOCK_CANCEL)

        buttons.pack_start(accept)
        buttons.pack_start(cancel)

        accept.connect('clicked', self._on_accept)
        cancel.connect('clicked', self._on_cancel)
        self.connect('delete_event', self._on_close)

        vbox.pack_start(self.config_table, True, False)

        separator = gtk.HSeparator()

        vbox.pack_start(separator, False, True, 5)
        vbox.pack_start(buttons, True)

        vbox.show_all()
        self.add(vbox)
Exemplo n.º 16
0
    def make_box1(self, homogeneous, spacing, expand, fill, padding):
        caja = gtk.HBox(homogeneous, spacing)

        separator = gtk.HSeparator()
        caja.pack_start(separator, False, False, 70)
        separator.show()

        image = gtk.Image()
        image.set_from_file(
            '/usr/share/icons/canaima-iconos/mimetypes/32/application-x-cue.png'
        )
        caja.pack_start(image, False, False, 5)
        image.show()

        descripcion = gtk.Label()
        descripcion.set_use_markup(True)
        descripcion.set_markup("<b>CREAR IMAGEN DEL NUEVO SABOR</b>")
        caja.pack_start(descripcion, False, False, 0)
        descripcion.show()
        caja.show()
        return caja
Exemplo n.º 17
0
    def make_label1(self, homogeneous, spacing, expand, fill, padding):

        caja = gtk.HBox(homogeneous, spacing)
        caja.set_border_width(10)

        separator = gtk.HSeparator()
        caja.pack_start(separator, False, False, 40)
        separator.show()

        image = gtk.Image()
        image.set_from_file('/usr/share/canaima-semilla-gui/images/distri.png')
        caja.pack_start(image, False, False, 5)
        image.show()

        descripcion = gtk.Label()
        descripcion.set_use_markup(True)
        descripcion.set_markup(
            "\n<b>CONSTRUCCIÓN DE NUEVOS SABORES CANAIMA</b>")
        caja.pack_start(descripcion, False, False, 5)
        descripcion.show()
        return caja
Exemplo n.º 18
0
    def __init__(self, base):
        gtk.ScrolledWindow.__init__(self)
        self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.set_shadow_type(gtk.SHADOW_NONE)

        test_list = ["cpu", "mem", "r_io", "w_io", "card"]

        vbox = gtk.VBox(False, 10)
        align = self.define_align(vbox, 0.0, 0.0, 1, 1)
        align.set_padding(10, 0, 0, 0)

        for id in test_list:
            test_item = TestItem(id)
            vbox.pack_start(test_item, False, False)
            separator = gtk.HSeparator()
            vbox.pack_start(separator, False, False)

        self.add_with_viewport(align)
        self.get_children()[0].modify_bg(gtk.STATE_NORMAL,
                                         gtk.gdk.color_parse("#FFFFFF"))
        self.show_all()
Exemplo n.º 19
0
 def __init__(self, parent):
     self.parent = parent
     self.win = gtk.Window(gtk.WINDOW_POPUP)
     self.frame = gtk.Frame("Shtoom - Notice")
     self.frame.set_border_width(8)
     vbox = gtk.VBox(False, 2)
     vbox.set_border_width(8)
     self.frame.add(vbox)
     self.label = gtk.Label(' ' * 25)
     vbox.pack_start(self.label)
     # Standard message dialog
     hbox = gtk.HBox(False, 5)
     vbox.pack_start(gtk.HSeparator(), False, False, 0)
     button = gtk.Button('Ok')
     button.connect('clicked', lambda x: self.slider.hide())
     hbox.pack_start(button, False, False, 0)
     vbox.pack_start(hbox, expand=False)
     self.win.add(self.frame)
     self.win.resize(200, 150)
     print("done", self.win)
     self.win.show()
Exemplo n.º 20
0
    def __init__(self, mode, book=None):
        """ init page """
        LbxPage.__init__(self, '%s_summary' % mode,
                         beam_text.titles['%s_summary' % mode],
                         beam_text.summaries['%s_summary' % mode], book)

        self.mode = mode
        summary = gtk.Label()
        summary.set_name("summary")

        align = gtk.Alignment(0, 1, 1, 1)
        align.add(summary)

        self.get_contentbox().pack_start(align, True, True)
        self.get_contentbox().pack_start(gtk.HSeparator(), False, False, 5)
        self.get_contentbox().pack_start(
            LbxNavButton(((_("<b><u>P</u></b>revious"), 'gtk-go-back'),
                          (_("<b><u>G</u></b>o"), 'gtk-go-forward'))), False,
            True)
        get_widget_r(self,
                     "navbutton_0").add_accelerator("clicked",
                                                    self.book.accel_group,
                                                    ord(_('P')),
                                                    gtk.gdk.CONTROL_MASK,
                                                    gtk.ACCEL_VISIBLE)
        get_widget_r(self,
                     "navbutton_1").add_accelerator("clicked",
                                                    self.book.accel_group,
                                                    ord(_('G')),
                                                    gtk.gdk.CONTROL_MASK,
                                                    gtk.ACCEL_VISIBLE)
        self.connect("show", self._cb_show, None)

        if self.mode == 'svg':
            get_widget_r(self, "navbutton_1").connect("clicked",
                                                      self.launch_backup, None)
        elif self.mode == 'rst':
            get_widget_r(self,
                         "navbutton_1").connect("clicked", self.launch_restore,
                                                None)
Exemplo n.º 21
0
    def __init__(self):
        self.parent = get_toplevel_window()
        self.win = gtk.Dialog(
            _('Limit'), self.parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
        Main().add_window(self.win)
        cancel_button = self.win.add_button(set_underline(_("Cancel")),
                                            gtk.RESPONSE_CANCEL)
        cancel_button.set_image(
            IconFactory.get_image('tryton-cancel', gtk.ICON_SIZE_BUTTON))
        cancel_button.set_always_show_image(True)
        ok_button = self.win.add_button(set_underline(_("OK")),
                                        gtk.RESPONSE_OK)
        ok_button.set_image(
            IconFactory.get_image('tryton-ok', gtk.ICON_SIZE_BUTTON))
        ok_button.set_always_show_image(True)
        self.win.set_default_response(gtk.RESPONSE_OK)
        self.win.set_icon(TRYTON_ICON)
        self.win.vbox.set_spacing(3)
        self.win.vbox.pack_start(gtk.Label(_('Search Limit Settings')),
                                 expand=False,
                                 fill=True)
        self.win.vbox.pack_start(gtk.HSeparator())
        hbox = gtk.HBox(spacing=3)
        label = gtk.Label(_('Limit:'))
        hbox.pack_start(label, expand=True, fill=True)
        adjustment = gtk.Adjustment(value=CONFIG['client.limit'],
                                    lower=1,
                                    upper=sys.maxsize,
                                    step_incr=10,
                                    page_incr=100)
        self.spin_limit = gtk.SpinButton()
        self.spin_limit.configure(adjustment, climb_rate=1, digits=0)
        self.spin_limit.set_numeric(False)
        self.spin_limit.set_activates_default(True)
        label.set_mnemonic_widget(self.spin_limit)
        hbox.pack_start(self.spin_limit, expand=True, fill=True)
        self.win.vbox.pack_start(hbox, expand=True, fill=True)

        self.win.show_all()
Exemplo n.º 22
0
    def make_webcam_data(self):
        """ build widgets for display of webcam properties"""
        self._dialog.vbox.pack_start(child=gtk.HSeparator(),
                                     expand=True,
                                     fill=True,
                                     padding=5)

        label = self.make_table_title(_('Webcam properties'))
        self._dialog.vbox.pack_start(child=label,
                                     expand=True,
                                     fill=True,
                                     padding=10)
        Hbox = gtk.HBox()
        if Hbox:
            #
            # Display Table
            #
            table = gtk.Table()
            table.set_homogeneous(False)
            self.make_table_webcam_row(table, 0, 'name')
            self.make_table_webcam_row(table, 1, 'width')
            self.make_table_webcam_row(table, 2, 'height')
            self.make_table_webcam_row(table, 3, 'source_input')
            self.make_table_webcam_row(table, 4, 'device')
            self.make_table_webcam_row(table, 5, 'framerate_list')
            # No lines for framerate_selected tag : handled framerate_list tag

            Hbox.pack_start(child=table, expand=True, fill=True, padding=10)
            #
            # Display Button fo webcam detetction
            #
            button = gtk.Button(_('Webcam detection'))
            button.connect('clicked', self.on_button_webcam_clicked)
            Hbox.pack_start(child=button, expand=False, fill=False, padding=10)

        # pack The HBox
        self._dialog.vbox.pack_start(child=Hbox,
                                     expand=True,
                                     fill=True,
                                     padding=10)
Exemplo n.º 23
0
def OpenERP_Progressbar(parent=None, title=_('OpenERP Computing')):
    if not parent:
        parent = service.LocalService('gui.main').window

    win = gtk.Dialog('OpenERP', parent,
                     gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
    win.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
    win.set_title(_(title))
    win.set_resizable(False)
    vbox = gtk.VBox(False, 0)

    hbox = gtk.HBox(False, 13)
    hbox.set_border_width(10)

    img = gtk.Image()
    img.set_from_stock('gtk-dialog-info', gtk.ICON_SIZE_DIALOG)
    hbox.pack_start(img, expand=True, fill=False)

    vbox2 = gtk.VBox(False, 0)
    label = gtk.Label()
    label.set_markup('<b>' + _('Operation in progress') + '</b>')
    label.set_alignment(0.0, 0.5)
    vbox2.pack_start(label, expand=True, fill=False)
    vbox2.pack_start(gtk.HSeparator(), expand=True, fill=True)
    vbox2.pack_start(gtk.Label(
        _("Please wait,\nthis operation may take a while...")),
                     expand=True,
                     fill=False)
    hbox.pack_start(vbox2, expand=True, fill=True)
    vbox.pack_start(hbox)

    pb = gtk.ProgressBar()
    pb.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
    vbox.pack_start(pb, expand=True, fill=False)

    win.vbox.pack_start(vbox, expand=True, fill=True)
    win.set_has_separator(False)
    win.set_transient_for(parent)
    win.show_all()
    return win, pb
Exemplo n.º 24
0
    def _init_rotation(self):
        self.checkbutton_scroll = gtk.CheckButton("Enable scrolling")
        self.checkbutton_scroll.set_active(self.chart.get_enable_scroll())
        self.checkbutton_scroll.connect("toggled", self._cb_scroll_changed)
        self.attach(self.checkbutton_scroll,
                    0,
                    3,
                    9,
                    10,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)

        self.scale_angle = gtk.HScale()
        self.scale_angle.set_range(0, 360)
        self.scale_angle.connect("change-value", self._cb_rotate_changed)
        label = gtk.Label("Rotation angle (degrees):")
        label.set_alignment(0.0, 0.5)
        self.attach(label,
                    0,
                    1,
                    10,
                    11,
                    xoptions=gtk.FILL,
                    yoptions=gtk.SHRINK)
        self.attach(self.scale_angle,
                    1,
                    3,
                    10,
                    11,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)
        self.chart.connect("notify", self._cb_chart_notify)

        self.attach(gtk.HSeparator(),
                    0,
                    3,
                    11,
                    12,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)
Exemplo n.º 25
0
 def _refreshStatistics(self, global_stats):
     for child in self.info_frame.get_children():
         self.info_frame.remove(child)
     self.info_frame.set_label("Statistics")
     regex_stats = self.analyzer.getRegexStats()
     plugins = global_stats[PLUGIN_DICT]
     box = gtk.VBox(False, 0)
     payloads = 'None'
     for plugin, amount in plugins.items():
         table = gtk.Table(6, 2, False)
         table.attach(gtk.Label("Plugin: "), 0, 1, 0, 1)
         table.attach(gtk.Label(plugin.getName()), 1, 2, 0, 1)
         table.attach(gtk.Label("Description: "), 0, 1, 1, 2)
         label = gtk.Label(plugin.getDescription())
         label.set_line_wrap(True)
         table.attach(label, 1, 2, 1, 2)
         table.attach(gtk.Label("Payloads: "), 0, 1, 2, 3)
         table.attach(gtk.Label(str(amount)), 1, 2, 2, 3)
         table.attach(gtk.Label("Regex hits: "), 0, 1, 3, 4)
         regex_cnt = "<b>%s</b>" % regex_stats[PLUGIN_DICT][plugin] if regex_stats[PLUGIN_DICT] else '<b>0</b>'
         label = gtk.Label()
         label.set_markup(regex_cnt)
         table.attach(label, 1, 2, 3, 4)
         table.attach(gtk.Label("Payload hits: "), 0, 1, 4, 5)
         payloads = '\n'.join(self.analyzer.getPayloadHits(plugin.getName())[:15])
         entry = gtk.Entry(0)
         entry.set_text(payloads)
         table.attach(entry, 1, 2, 4, 5, yoptions=gtk.FILL)
         table.attach(gtk.Label("Parameters: "), 0, 1, 5, 6)
         params = '\n'.join(global_stats[PARAMS_DICT])
         table.attach(gtk.Label(params), 1, 2, 5, 6) 
         box.pack_start(table, False, False, 0)
         box.pack_start(gtk.HSeparator(), False, False, 0)
     
     sw = gtk.ScrolledWindow()
     sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     sw.add_with_viewport(box)
     self.info_frame.add(sw)
     self.info_frame.show_all()
     return True
Exemplo n.º 26
0
    def test_non_whites(self):
        main_box = gtk.VBox(False, 2)

        v = gtk.TextView()

        bf = v.get_buffer()

        v.connect('destroy', gtk.main_quit)

        v.set_size_request(200, 200)

        main_box.pack_start(v, True, True, 2)

        main_box.pack_start(gtk.HSeparator(), False, False, 2)

        nonwhites_button = gtk.Button('_Check')
        nonwhites_box = gtk.HBox(False, 2)
        nonwhites_label = gtk.Label('Non-Whites:')
        nonwhites_entry = gtk.Entry()
        nonwhites_box.pack_start(nonwhites_button, False, False, 2)
        nonwhites_box.pack_start(nonwhites_label, False, False, 2)
        nonwhites_box.pack_start(nonwhites_entry, True, True, 2)

        main_box.pack_start(nonwhites_box, False, False, 2)

        main_wnd = gtk.Window(gtk.WINDOW_TOPLEVEL)
        main_wnd.set_title('Non-Whites Test')
        main_wnd.add(main_box)

        def on_check_non_whites(b):
            non_white = num_non_whites_till_cur(bf)

            nonwhites_entry.set_text(str(non_white))

            cursor_to_non_whites(v, non_white)

        nonwhites_button.connect('clicked', on_check_non_whites)

        main_wnd.show_all()
        gtk.main()
Exemplo n.º 27
0
    def create_config_baseimg(self):
        self.image_title = gtk.Label()
        self.image_title.set_alignment(0, 1.0)
        mark = "<span %s>Select an image recipe</span>" % self.span_tag(
            'x-large', 'bold')
        self.image_title.set_markup(mark)

        self.image_title_desc = gtk.Label()
        self.image_title_desc.set_alignment(0, 0.5)

        mark = (
            "<span %s>Image recipes are a starting point for the type of image you want. "
            "You can build them as \n"
            "they are or edit them to suit your needs.\n</span>"
        ) % self.span_tag('medium')
        self.image_title_desc.set_markup(mark)

        self.image_combo = gtk.combo_box_new_text()
        self.image_combo.set_row_separator_func(self.combo_separator_func,
                                                None)
        self.image_combo_id = self.image_combo.connect(
            "changed", self.image_combo_changed_cb)

        self.image_desc = gtk.Label()
        self.image_desc.set_alignment(0.0, 0.5)
        self.image_desc.set_size_request(256, -1)
        self.image_desc.set_justify(gtk.JUSTIFY_LEFT)
        self.image_desc.set_line_wrap(True)

        # button to view recipes
        icon_file = hic.ICON_RCIPE_DISPLAY_FILE
        hover_file = hic.ICON_RCIPE_HOVER_FILE
        self.view_adv_configuration_button = HobImageButton(
            "Advanced configuration",
            "Select image types, package formats, etc", icon_file, hover_file)
        self.view_adv_configuration_button.connect(
            "clicked", self.view_adv_configuration_button_clicked_cb)

        self.image_separator = gtk.HSeparator()
Exemplo n.º 28
0
    def __init__(self, parent=None):
        gtk.Window.__init__(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())
        self.set_title(self.__class__.__name__)
        self.set_border_width(0)
        self.set_icon_from_file(ICON_IMAGE)
        self.set_geometry_hints(min_width=100, min_height=100)

        uimanager = gtk.UIManager()
        accelgroup = uimanager.get_accel_group()
        self.add_accel_group(accelgroup)

        box1 = gtk.VBox(False, 0)
        self.add(box1)

        # box1.pack_start(ui.get_widget("/MenuBar"), False, False, 0)

        label = gtk.Label("Type\n<alt>\nto start")
        label.set_size_request(200, 200)
        label.set_alignment(0.5, 0.5)
        box1.pack_start(label, True, True, 0)

        separator = gtk.HSeparator()
        box1.pack_start(separator, False, True, 0)

        box2 = gtk.VBox(False, 10)
        box2.set_border_width(10)
        box1.pack_start(box2, False, True, 0)

        button = gtk.Button("close")
        button.connect("clicked", lambda b, w=self: w.destroy())
        box2.pack_start(button, True, True, 0)
        button.set_flags(gtk.CAN_DEFAULT)
        button.grab_default()

        self.show_all()
Exemplo n.º 29
0
    def create_config_machine(self):
        self.machine_title = gtk.Label()
        self.machine_title.set_alignment(0.0, 0.5)
        mark = "<span %s>Select a machine</span>" % self.span_tag(
            'x-large', 'bold')
        self.machine_title.set_markup(mark)

        self.machine_title_desc = gtk.Label()
        self.machine_title_desc.set_alignment(0.0, 0.5)
        mark = (
            "<span %s>Your selection is the profile of the target machine for which you"
            " are building the image.\n</span>") % (self.span_tag('medium'))
        self.machine_title_desc.set_markup(mark)

        self.machine_combo = gtk.combo_box_new_text()
        self.machine_combo.connect("changed", self.machine_combo_changed_cb)

        icon_file = hic.ICON_LAYERS_DISPLAY_FILE
        hover_file = hic.ICON_LAYERS_HOVER_FILE
        self.layer_button = HobImageButton(
            "Layers", "Add support for machines, software, etc.", icon_file,
            hover_file)
        self.layer_button.connect("clicked", self.layer_button_clicked_cb)

        markup = "Layers are a powerful mechanism to extend the Yocto Project "
        markup += "with your own functionality.\n"
        markup += "For more on layers, check the <a href=\""
        markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
        markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
        self.layer_info_icon = HobInfoButton(markup, self.get_parent())

        self.progress_box = gtk.HBox(False, 6)
        self.progress_bar = HobProgressBar()
        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        self.progress_box.pack_end(self.stop_button, expand=False, fill=False)

        self.machine_separator = gtk.HSeparator()
Exemplo n.º 30
0
 def __init__(self, parent):
     gtk.Window.__init__(self)
     self.set_transient_for(parent)
     self.set_destroy_with_parent(True)
     self.set_modal(True)
     vbox = gtk.VBox()
     vbox.set_spacing(4)
     self.add(vbox)
     self.set_default_size(630, 400)
     self.g_logwidget = LogWidget()
     vbox.pack_start(self.g_logwidget)
     vbox.pack_start(gtk.HSeparator(), False, False)
     bbox = gtk.HButtonBox()
     bbox.set_layout(gtk.BUTTONBOX_END)
     vbox.pack_start(bbox, False, False)
     self.g_close_button = gtk.Button(stock="gtk-close")
     self.g_close_button.set_sensitive(False)
     self.g_close_button.connect('clicked', lambda w: self.destroy())
     bbox.pack_start(self.g_close_button)
     self.show_all()
     self.write = self.g_logwidget.write
     self.popen = self.g_logwidget.popen