Esempio n. 1
0
    def __init__(self):
        # Create GUI objects
        rgbaColormap = gtk.gdk.screen_get_default().get_rgba_colormap()
        if rgbaColormap != None:
            gtk.gdk.screen_get_default().set_default_colormap(rgbaColormap)
        self.testedEffect = "hover"
        self.window = gtk.Window()
        self.window.connect("destroy", gtk.main_quit)

        self.vbox = gtk.VBox()
        self.effectsHBox = gtk.HBox()

        self.align1 = gtk.Alignment()
        self.eda = EffectedDA()
        ICON_SIZE = 48
        self.eda.set_size_request(ICON_SIZE*6/5, ICON_SIZE*2)
        self.align1.add(self.eda)
        self.align1.set(0.5, 0.5, 0.5, 0.75)
        self.eda.connect("button-release-event", self.OnButton)
        self.eda.connect("enter-notify-event", self.OnMouseOver)
        self.eda.connect("leave-notify-event", self.OnMouseOut)
        self.effectsHBox.add(self.align1)

        self.bb = gtk.VButtonBox()
        self.quitButton = gtk.Button(stock='gtk-quit')
        self.quitButton.connect("clicked", self.OnQuit)
        self.vbox.pack_start(self.effectsHBox)
        self.svgButton = gtk.Button("SVG")
        self.svgButton.connect("clicked", self.eda.toggle_svg_usage)
        self.bb.add(self.svgButton)
        self.bb.add(self.quitButton)
        self.vbox.pack_start(self.bb)
        self.window.add(self.vbox)

        self.window.show_all()
Esempio n. 2
0
	def __init__(self):
		gtk.Frame.__init__(self)
		self.set_label('Тара (таблица значений) ')		
		hbox=gtk.HBox()
		
		hbox=gtk.HBox()
		lfbox=gtk.VBox()
		lfbox.pack_start(self.__set_tree(),True,True,4)
		lfbox.pack_start(self.__dwn_lf_panel(),False,True,4)
		hbox.pack_start(lfbox,True,True,4)
		rfbox=gtk.VButtonBox()
		rfbox.set_border_width(5)
		okbutton=gtk.Button('ОК')
		okbutton.set_sensitive(False)
		cancelbutton=gtk.Button('Отмена')
		cancelbutton.set_sensitive(False)
		cancelbutton.connect('clicked',self.__on_click,'close')
		sendbutton=gtk.Button('PC -> Весы')
		sendbutton.connect('clicked',self.__on_click,'sendcale')
		recivebutton=gtk.Button('Весы -> РС')
		recivebutton.connect('clicked',self.__on_click,'resivescale')
		rfbox.add(okbutton)
		rfbox.add(cancelbutton)
		rfbox.add(sendbutton)
		rfbox.add(recivebutton)
		hbox.pack_start(rfbox,False,True,4)		
		
		self.add(hbox)
		self.show_all()
		pass
Esempio n. 3
0
 def init(self):
     # Die RAD!
     hb = gtk.HBox()
     self.widget.pack_start(hb, expand=False, padding=2)
     self.__pattern_entry = gtk.Entry()
     hb.pack_start(self.__pattern_entry)
     l = gtk.Label()
     l.set_markup(SMALL_MU % 'in')
     hb.pack_start(l, expand=False)
     self.__path_entry = filedialogs.FolderButton()
     hb.pack_start(self.__path_entry)
     self.__recursive = gtk.CheckButton('-R')
     hb.pack_start(self.__recursive, expand=False)
     hb = gtk.HBox()
     self.widget.pack_start(hb, expand=False)
     self.__status_bar = gtk.ProgressBar()
     self.__status_bar.set_size_request(-1, 32)
     self.__status_bar.set_pulse_step(0.01)
     hb.pack_start(self.__status_bar, padding=4)
     self.__stop_but = gtk.Button(stock=gtk.STOCK_STOP)
     hb.pack_start(self.__stop_but, expand=False)
     self.__stop_but.set_sensitive(False)
     self.__stop_but.connect('clicked', self.cb_stop_clicked)
     self.__start_but = gtk.Button(stock=gtk.STOCK_FIND)
     hb.pack_start(self.__start_but, expand=False)
     self.__start_but.connect('clicked', self.cb_start_clicked)
     #self.add_button('apply', 'apply', 'Start the search')
     #self.add_button('stop', 'stop', 'Stop the search')
     hb = gtk.HBox()
     l = gtk.Label()
     hb.pack_start(l, expand=True)
     l.set_markup(EXPANDER_LABEL_MU)
     self.__details_expander = gtk.Expander()
     self.__details_expander.set_label_widget(hb)
     self.widget.pack_start(self.__details_expander, expand=False)
     details_box = gtk.Table(4, 3)
     self.__details_expander.add(details_box)
     details_box.set_col_spacings(4)
     self.__dir_box = gtk.HBox()
     details_box.attach(self.__dir_box, 1, 3, 0, 1)
     self.__ignore_vcs = gtk.CheckButton(
         "Ignore Version Control Directories")
     details_box.attach(self.__ignore_vcs, 0, 1, 1, 2)
     resbox = gtk.HBox()
     self.widget.pack_start(resbox)
     butbox = gtk.VButtonBox()
     resbox.pack_start(butbox, expand=False)
     self.__results_tree = tree.Tree()
     self.__results_tree.set_property('markup-format-string', '%(markup)s')
     resbox.pack_start(self.__results_tree)
     self.__results_tree.connect('clicked', self.cb_result_activated)
     self.__context_expander = gtk.Expander(label=RESULTS_LABEL_MU)
     self.__context_expander.set_use_markup(True)
     self.widget.pack_start(self.__context_expander, expand=False)
     self.__context_expander.set_expanded(True)
     contextbox = gtk.HBox()
     self.__context_expander.add(contextbox)
     self.__context_label = gtk.Label()
     self.__context_label.set_alignment(0, 0)
     contextbox.pack_start(self.__context_label, padding=4)
    def showMessage(self, messageDialog, vertical=False):
        if self.messageSock.child:
            self.messageSock.remove(self.messageSock.child)

        message = messageDialog.child.get_children()[0]
        hbuttonbox = messageDialog.child.get_children()[-1]

        if vertical:
            buttonbox = gtk.VButtonBox()
            buttonbox.props.layout_style = gtk.BUTTONBOX_SPREAD
            for button in hbuttonbox.get_children():
                hbuttonbox.remove(button)
                buttonbox.add(button)
        else:
            messageDialog.child.remove(hbuttonbox)
            buttonbox = hbuttonbox
            buttonbox.props.layout_style = gtk.BUTTONBOX_SPREAD

        messageDialog.child.remove(message)
        texts = message.get_children()[1]
        message.set_child_packing(texts, False, False, 0, gtk.PACK_START)
        text1, text2 = texts.get_children()
        text1.props.yalign = 1
        text2.props.yalign = 0
        texts.set_child_packing(text1, True, True, 0, gtk.PACK_START)
        texts.set_child_packing(text2, True, True, 0, gtk.PACK_START)
        texts.set_spacing(3)
        message.pack_end(buttonbox, True, True)
        if self.messageSock.child:
            self.messageSock.remove(self.messageSock.child)
        self.messageSock.add(message)
        self.messageSock.show_all()
        if self == cur_gmwidg():
            notebooks["messageArea"].show()
Esempio n. 5
0
    def getButtons(self):
        '''
        Get the Buttons
        
        @return: ButtonBox
        '''

        box = gtk.VButtonBox()
        box.set_border_width(5)
        box.set_spacing(0)

        button = gtk.Button(label=_("Login"))
        button.set_image(
            gtk.image_new_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_MENU))
        button.connect("clicked", self.clickLogin)
        button.set_relief(gtk.RELIEF_NONE)
        box.add(button)
        self.loginButton = button

        button = gtk.Button(label=_("Find Public Servers"))
        button.set_image(
            gtk.image_new_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU))
        button.connect("clicked", self.findServer_cb)
        button.set_relief(gtk.RELIEF_NONE)
        box.add(button)

        return box
Esempio n. 6
0
    def __init__(self, profile=None, device=None, parent=None):
        """Edit manager for track of device in a profile"""
        self.superior = parent
        gtk.HBox.__init__(self, False, 5)
        self.set_border_width(20)
        self.profile = profile
        self.device = device

        self.buttons = gtk.VButtonBox()
        self.buttons.set_layout(gtk.BUTTONBOX_START)
        self.buttons.set_spacing(5)

        self.add_button("Save", self.retrieve_data)        
        #self.add_button("Test", self.test_track, True)      
        self.add_button("Cancel", self.close, True)  

        self.table = None
        self.model = None

        if device.device:
            self.table,self.model,self.combo = self.prepare_device(device)
            self.combo.connect("changed",self.show_options)
        else:
            self.table,self.model,self.combo = self.prepare_empty_device()
            self.combo.connect("changed",self.show_options)

        self.table.attach(self.combo,1,2,0,1,0,0)
        self.pack_start(self.table,True,True,0)
        self.pack_start(self.buttons,False,False,20)
        self.show_all() 
Esempio n. 7
0
    def create_lr_box(self, horizontal, title, spacing, layout):
        frame = gtk.Frame(title)

        if horizontal:
            bbox = gtk.HButtonBox()
        else:
            bbox = gtk.VButtonBox()

        bbox.set_border_width(5)
        frame.add(bbox)

        # Set the appearance of the Button Box
        bbox.set_layout(layout)
        bbox.set_spacing(spacing)

        button_left = gtk.Button("Move Left")
        button_left.connect("clicked", self.callback_move_left, "Move Left")
        bbox.add(button_left)
        
        button_right = gtk.Button("Move Right")
        button_right.connect("clicked", self.callback_move_right, "Move Right")
        bbox.add(button_right)       
        
      
        return frame
Esempio n. 8
0
    def _create_box_toolbar(self):
        """ """
        toolbarButtonbox = gtk.VButtonBox()
        breedGenerationButton = gtk.Button(_('Breed'))
        toolbarButtonbox.pack_start(breedGenerationButton,
                                    expand=True,
                                    fill=True)
        self._widget_list.remember('breedGenerationButton',
                                   breedGenerationButton)

        flurryLabel = gtk.Label(_('Flurry rate:'))
        toolbarButtonbox.pack_start(flurryLabel, expand=True, fill=True)

        adjustmentSpinButton = gtk.Adjustment(value=0,
                                              lower=0,
                                              upper=9,
                                              step_incr=1,
                                              page_incr=3,
                                              page_size=0)
        flurrySpinButton = gtk.SpinButton(adjustment=adjustmentSpinButton)
        toolbarButtonbox.pack_start(flurrySpinButton, expand=True, fill=True)
        self._widget_list.remember('flurrySpinButton', flurrySpinButton)

        hseparator1 = gtk.HSeparator()
        toolbarButtonbox.pack_start(hseparator1, expand=True, fill=True)

        randomGenerationButton = gtk.Button(_('Random'))
        toolbarButtonbox.pack_start(randomGenerationButton,
                                    expand=True,
                                    fill=True)
        self._widget_list.remember('randomGenerationButton',
                                   randomGenerationButton)
        return toolbarButtonbox
Esempio n. 9
0
    def create_bbox(self, horizontal, title, spacing, layout):
        frame = gtk.Frame(title)

        if horizontal:
            bbox = gtk.HButtonBox()
        else:
            bbox = gtk.VButtonBox()

        bbox.set_border_width(5)
        frame.add(bbox)

        # Set the appearance of the Button Box
        bbox.set_layout(layout)
        bbox.set_spacing(spacing)

        button = gtk.Button(stock=gtk.STOCK_OK)
        bbox.add(button)

        button = gtk.Button(stock=gtk.STOCK_CANCEL)
        bbox.add(button)

        button = gtk.Button(stock=gtk.STOCK_HELP)
        bbox.add(button)

        return frame
Esempio n. 10
0
def main():
    import sys

    device = sys.argv[1]

    def dummy(*args):
        gtk.main_quit()

    window = gtk.Window()
    window.connect('delete-event', dummy)

    vbbox = gtk.VButtonBox()
    window.add(vbbox)

    window.mountpoint = None

    def test_mount(b):
        window.mountpoint = mount(window, device)

    button = gtk.Button('Mount')
    button.connect('clicked', test_mount)
    vbbox.add(button)

    def test_unmount(b):
        unmount(window, device, window.mountpoint)

    button = gtk.Button('Unmount')
    button.connect('clicked', test_unmount)
    vbbox.add(button)

    window.show_all()

    gtk.main()
Esempio n. 11
0
    def __init__(self):
        gtk.HBox.__init__(self, spacing=5)

        self.buttons = gtk.VButtonBox()
        self.buttons.set_layout(gtk.BUTTONBOX_START)

        self.table = gtk.Table(1, 3)
        self.script = MainBlock()
        self.script.attach(self.table, 0, 0)

        gscw = gtk.ScrolledWindow()
        gscw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        gscw.add_with_viewport(self.table)

        self.pack_start(gscw, True, True)
        self.pack_end(self.buttons, False, False)

        ba = gtk.Button(_('Add command'))
        ba.connect('clicked', self.add_command)
        self.buttons.add(ba)

        self.endloop = gtk.Button(_('End loop'))
        self.endloop.connect('clicked', self.end_loop)
        self.endloop.set_sensitive(False)
        self.buttons.add(self.endloop)

        bc = gtk.Button(_('Clear'))
        bc.connect('clicked', self.script.clear)
        self.buttons.add(bc)

        self.script.connect('script-changed', self.script_changed)
Esempio n. 12
0
    def fillFrameParams(self):
        if self.wsdl:
            for child in self.frame_params.get_children():
                self.frame_params.remove(child)
            self.frame_params.set_label("Parameters")
            ops = self.wsdl.getParamsNames(self.selected_op)
            sw = gtk.ScrolledWindow()
            sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
            if ops:
                vbtnbox = gtk.VButtonBox()
                vbtnbox.set_layout(gtk.BUTTONBOX_START)
                vbtnbox.set_spacing(1)
                for op in ops:
                    chkbtn = gtk.CheckButton(op)
                    chkbtn.connect("toggled", self.paramSelected,
                                   chkbtn.get_label())
                    vbtnbox.add(chkbtn)

                vbtnbox.add(gtk.HSeparator())
                vbtnbox.add(self.getCheckButtons(vbtnbox))
                sw.add_with_viewport(vbtnbox)
                self.frame_params.add(sw)
            else:
                self.frame_params.add(
                    gtk.Label("This method has no parameters"))

        self.frame_params.show_all()
Esempio n. 13
0
    def __init__(self):
        super(type(self), self).__init__(self)

        self._label = gtk.Label("Start here")
        self.add(self._label)
        self.show_all()

        self._hbox = gtk.HBox()

        box = gtk.VButtonBox()
        box.set_layout(gtk.BUTTONBOX_START)
        box.set_border_width(30)

        button = gtk.Button("Create a new project")
        button.set_alignment(0, 0.5)
        button.set_image(
            gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_BUTTON))
        box.add(button)

        button = gtk.Button("Open an existing project")
        button.set_alignment(0, 0.5)
        button.set_image(
            gtk.image_new_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON))
        box.add(button)

        button = gtk.Button("About Taluka")
        button.set_alignment(0, 0.5)
        button.set_image(
            gtk.image_new_from_stock(gtk.STOCK_ABOUT, gtk.ICON_SIZE_BUTTON))
        box.add(button)

        self._hbox.add(box)

        self._hbox.show_all()
Esempio n. 14
0
def create_bbox(horizontal=True,
                title=None,
                spacing=0,
                layout=gtk.BUTTONBOX_SPREAD):
    frame = gtk.Frame(title)

    if horizontal:
        bbox = gtk.HButtonBox()
    else:
        bbox = gtk.VButtonBox()

    bbox.set_border_width(5)
    bbox.set_layout(layout)
    bbox.set_spacing(spacing)
    frame.add(bbox)

    button = gtk.Button(stock='gtk-ok')
    bbox.add(button)

    button = gtk.Button(stock='gtk-cancel')
    bbox.add(button)

    button = gtk.Button(stock='gtk-help')
    bbox.add(button)

    return frame
Esempio n. 15
0
def creator_VBoxSections(workplace_box_list):
    objVBoxSections = gtk.VBox()

    sections = ["Notificator", "Admin tools"]

    objVBoxSections.set_usize(150, 450)
    box_section_size = objVBoxSections.get_size_request()

    objButtonBox = gtk.VButtonBox()
    objButtonBox.set_layout(gtk.BUTTONBOX_START)

    for i in range(len(sections)):
        objTButton = gtk.ToggleButton(label=sections[i])
        button_height = box_section_size[0]
        button_width = box_section_size[1] / len(sections)
        objTButton.set_usize(button_height, button_width)
        objButtonBox.add(objTButton)
        objTButton.connect("toggled", buttons_listeners.changer_workplace,
                           workplace_box_list[i]["box"], objButtonBox)

    objVBoxSections.pack_start(objButtonBox, expand=True, fill=True, padding=0)
    objFrameVBoxSections = gtk.Frame()
    objFrameVBoxSections.add(objVBoxSections)
    objFrameVBoxSections.show_all()
    return objFrameVBoxSections
Esempio n. 16
0
    def createeth(self, vertical, title, spacing, layout):
        frame = gtk.Frame(title)

        bbox = gtk.VButtonBox()

        bbox.set_border_width(5)
        frame.add(bbox)

        bbox.set_layout(layout)
        bbox.set_spacing(spacing)

        button2 = gtk.RadioButton(None, "None")
        bbox.add(button2)

        button2 = gtk.RadioButton(button2, "eth0")
        button2.connect("toggled", self.eth0_select)
        bbox.add(button2)

        button2 = gtk.RadioButton(button2, "eth1")
        button2.connect("toggled", self.eth1_select)
        bbox.add(button2)

        button2 = gtk.RadioButton(button2, "eth2")
        button2.connect("toggled", self.eth2_select)
        bbox.add(button2)

        return frame
Esempio n. 17
0
  def __init__(self):
    super(PyApp,self).__init__()
    
    self.set_title("Button box demo")
    self.set_size_request(200,100)
    self.set_position(gtk.WIN_POS_CENTER)
    
    vb=gtk.VBox()
    box1=gtk.VButtonBox()
    btn1=gtk.Button(stock=gtk.STOCK_OK)
    btn2=gtk.Button(stock=gtk.STOCK_CANCEL)
  
    box1.pack_start(btn1,True,True,0)
    box1.pack_start(btn2,True,True,0)
    box1.set_border_width(5)

    vb.add(box1)
    
    box2=gtk.HButtonBox()
    btn3=gtk.Button(stock=gtk.STOCK_OK)
    btn4=gtk.Button(stock=gtk.STOCK_CANCEL)
   
    ent=gtk.Entry()
    box2.pack_start(btn3,True,True,0)
    box2.pack_start(btn4,True,True,0)
    box1.set_border_width(5)
    
    vb.add(box2)
    self.add(vb)
    

    self.show_all()
    def __init__(self, ui):
        Dialog.__init__(self,
                        ui,
                        _('Templates'),
                        help='Help:Templates',
                        buttons=gtk.BUTTONS_CLOSE,
                        defaultwindowsize=(400, 450))
        # T: Dialog title

        label = gtk.Label()
        label.set_markup('<b>' + _('Templates') + '</b>')
        # T: Section in dialog
        label.set_alignment(0.0, 0.5)
        self.vbox.pack_start(label, False)

        hbox = gtk.HBox()
        self.vbox.add(hbox)

        self.view = TemplateListView()
        self.view.connect('row-activated', self.on_selection_changed)
        hbox.add(ScrolledWindow(self.view))

        vbbox = gtk.VButtonBox()
        vbbox.set_layout(gtk.BUTTONBOX_START)
        hbox.pack_start(vbbox, False)

        view_button = Button(stock='gtk-file',
                             label=_('_View'))  # T: button label
        view_button.connect('clicked', self.on_view)

        copy_button = Button(stock='gtk-copy')
        copy_button.connect('clicked', self.on_copy)

        edit_button = Button(stock='gtk-edit')
        edit_button.connect('clicked', self.on_edit)

        delete_button = gtk.Button(stock='gtk-remove')
        delete_button.connect('clicked', self.on_delete)

        for b in (view_button, copy_button, edit_button, delete_button):
            b.set_alignment(0.0, 0.5)
            vbbox.add(b)

        browse_button = Button(_('Browse'))  # T: button label
        browse_button.connect('clicked', self.on_browse)
        self.add_extra_button(browse_button)

        self._buttonbox = vbbox
        self._delete_button = delete_button
        self.on_selection_changed()

        ## Same button appears in export dialog
        if gtk.gtk_version >= (2, 10) \
        and gtk.pygtk_version >= (2, 10):
            url_button = gtk.LinkButton(
                'http://zim-wiki.org/more_templates.html',
                _('Get more templates online')  # T: label for button with URL
            )
            self.vbox.pack_start(url_button, False)
Esempio n. 19
0
    def getProxyInfo(self):
        '''
        Return widgets for setting proxy information
        '''
        p_left = gtk.VBox(True, 3)
        p_right = gtk.VBox(True, 3)
        bbox = gtk.VButtonBox()
        proxyTop = gtk.HBox(False, 3)
        proxyBox = gtk.VBox(False, 3)

        selectedProxyType = self.optionmanager.get_default_option(
            OPTION_PROXY_TYPE, OPTION_PROXY_HTTP)

        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_("Username")),
                          False, False, 0)
        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_('Password')),
                          False, False, 0)
        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_("Host")), False,
                          False, 0)

        for field, tip in ((OPTION_PROXY_USER, None), (OPTION_PROXY_PASSWORD,
                                                       None),
                           (OPTION_PROXY_HOST,
                            _('Value should be <hostname>:<port>'))):
            e = gtk.Entry()
            e.set_text(self.optionmanager.get_default_option(field, ''))
            e.connect("changed", self.entryChanged_cb, field)
            if tip is not None:
                self.tips.set_tip(e, tip)
            p_right.pack_start(e, False, False, 0)

        button = gtk.RadioButton(None, _('HTTP'))
        button.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE,
                       OPTION_PROXY_HTTP)
        button.set_active(selectedProxyType == OPTION_PROXY_HTTP)
        bbox.pack_start(button)
        #button1 = gtk.RadioButton(button, _('SOCKS V4'))
        #button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS4)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS4)
        #bbox.pack_start(button1)
        #button1 = gtk.RadioButton(button, _('SOCKS V5'))
        ##button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS5)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS5)
        #bbox.pack_start(button1)

        proxyTop.pack_start(p_left, False, False, 0)
        proxyTop.pack_start(p_right, False, False, 0)

        proxyBox.pack_start(proxyTop, False, False, 0)
        proxyBox.pack_start(bbox, False, False, 0)
        proxyBox.set_sensitive(
            self.optionmanager.get_default_bool_option(OPTION_USE_PROXY,
                                                       False))

        return proxyBox
Esempio n. 20
0
	def __init__(self, ui, callback=None):
		Dialog.__init__(self, ui, _('Open Notebook')) # T: dialog title
		# TODO set button to "OPEN" instead of "OK"
		self.callback = callback
		self.set_default_size(500, 400)
		self.set_help(':Help:Notebooks')

		# show some art work in an otherwise boring dialog
		path = data_file('globe_banner_small.png').path
		image = gtk.Image()
		image.set_from_file(path) # new_from_file not in 2.6
		align = gtk.Alignment(0, 0.5, 0, 0)
		align.add(image)
		self.vbox.pack_start(align, False)

		# split between treeview and vbuttonbox
		hbox = gtk.HBox(spacing=12)
		self.vbox.add(hbox)

		# add notebook list - open notebook on clicking a row
		self.treeview = NotebookTreeView()
		self.treeview.connect(
			'row-activated', lambda *a: self.response(gtk.RESPONSE_OK))

		hbox.add(ScrolledWindow(self.treeview))

		# add buttons for modifying the treeview
		vbbox = gtk.VButtonBox()
		vbbox.set_layout(gtk.BUTTONBOX_START)
		hbox.pack_start(vbbox, False)
		add_button = gtk.Button(stock='gtk-add')
		add_button.connect('clicked', self.do_add_notebook)
		#~ edit_button = gtk.Button(stock='gtk-edit')
		#~ edit_button.connect('clicked', self.do_edit_notebook)
		rm_button = gtk.Button(stock='gtk-remove')
		rm_button.connect('clicked', self.do_remove_notebook)
		#~ for b in (add_button, edit_button, rm_button):
		for b in (add_button, rm_button):
			b.set_alignment(0.0, 0.5)
			vbbox.add(b)
		# FIXME buttons for "up" and "down" ?

		# add dropdown to select default
		self.combobox = DefaultNotebookComboBox(self.treeview.get_model())

		# clear button de-selects any item in the combobox
		clear_button = IconButton('gtk-clear')
		clear_button.connect('clicked', lambda o: self.combobox.set_active(-1))

		hbox = gtk.HBox(spacing=5)
		hbox.pack_start(gtk.Label(_('Default notebook') + ': '), False)
			# T: Input label in 'open notebook' dialog
		hbox.pack_start(self.combobox, False)
		hbox.pack_start(clear_button, False)
		self.vbox.pack_start(hbox, False)
Esempio n. 21
0
    def _create_dialog(self):
        """
        Create a dialog box to organize tags.
        """
        # pylint: disable-msg=E1101
        title = _("%(title)s - Gramps") % {'title': _("Organize Tags")}
        top = gtk.Dialog(title)
        top.set_default_size(400, 350)
        top.set_modal(True)
        top.set_transient_for(self.parent_window)
        top.set_has_separator(False)
        top.vbox.set_spacing(5)
        label = gtk.Label('<span size="larger" weight="bold">%s</span>' %
                          _("Organize Tags"))
        label.set_use_markup(True)
        top.vbox.pack_start(label, 0, 0, 5)
        box = gtk.HBox()
        top.vbox.pack_start(box, 1, 1, 5)

        name_titles = [
            ('', NOSORT, 20, INTEGER),  # Priority
            ('', NOSORT, 100),  # Handle
            (_('Name'), NOSORT, 200),
            (_('Color'), NOSORT, 50, COLOR)
        ]
        self.namelist = gtk.TreeView()
        self.namemodel = ListModel(self.namelist, name_titles)

        slist = gtk.ScrolledWindow()
        slist.add_with_viewport(self.namelist)
        slist.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        box.pack_start(slist, 1, 1, 5)
        bbox = gtk.VButtonBox()
        bbox.set_layout(gtk.BUTTONBOX_START)
        bbox.set_spacing(6)
        up = gtk.Button(stock=gtk.STOCK_GO_UP)
        down = gtk.Button(stock=gtk.STOCK_GO_DOWN)
        add = gtk.Button(stock=gtk.STOCK_ADD)
        edit = gtk.Button(stock=gtk.STOCK_EDIT)
        remove = gtk.Button(stock=gtk.STOCK_REMOVE)
        up.connect('clicked', self.cb_up_clicked)
        down.connect('clicked', self.cb_down_clicked)
        add.connect('clicked', self.cb_add_clicked, top)
        edit.connect('clicked', self.cb_edit_clicked, top)
        remove.connect('clicked', self.cb_remove_clicked, top)
        top.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
        top.add_button(gtk.STOCK_HELP, gtk.RESPONSE_HELP)
        bbox.add(up)
        bbox.add(down)
        bbox.add(add)
        bbox.add(edit)
        bbox.add(remove)
        box.pack_start(bbox, 0, 0, 5)
        top.show_all()
        return top
Esempio n. 22
0
    def __init__(self, parent=None):

        # Create the toplevel window
        gtk.Window.__init__(self)

        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())

        self.num_buttons = 10
        self.buttons = self.num_buttons * [None]
        self.clipboard_history = self.num_buttons * [None]
        self.set_title(self.__class__.__name__)
        self.set_default_size(200, 200)
        self.set_icon_from_file(ICON_IMAGE)
        self.set_geometry_hints(min_width=100, min_height=100)
        self.set_border_width(0)
        vbbox = gtk.VButtonBox()
        vbbox.show()
        vbbox.set_layout(gtk.BUTTONBOX_START)
        hbox = gtk.HBox()
        hbox.pack_start(vbbox, False)
        hbox.show()
        self.button_tips = gtk.Tooltips()

        for i in range(self.num_buttons):
            self.buttons[i] = gtk.Button("---")
            self.buttons[i].set_use_underline(False)
            vbbox.pack_start(self.buttons[i])
            self.buttons[i].show()
            self.buttons[i].connect("clicked", self.clicked_cb)

        vbox = gtk.VBox()

        scrolledwin = gtk.ScrolledWindow()

        self.textview = gtk.TextView()

        self.textview.set_size_request(200, 100)
        self.textview.set_wrap_mode(gtk.WRAP_CHAR)
        self.textbuffer = self.textview.get_buffer()
        scrolledwin.add(self.textview)
        vbox.pack_start(scrolledwin)
        button = gtk.Button('Copy to Clipboard')

        button.connect('clicked', self.set_clipboard)
        vbox.pack_start(button, False)
        hbox.pack_start(vbox)
        self.add(hbox)

        self.clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
        self.clipboard.request_text(self.clipboard_text_received)
        gobject.timeout_add(1500, self.fetch_clipboard_info)
        self.show_all()
Esempio n. 23
0
File: graph.py Progetto: MorS25/wasp
    def __init__(self, g, name, adjustable, on_pause, on_print, on_remove,
                 on_fullscreen, on_log_data):
        gtk.HBox.__init__(self, spacing=5)

        self.graph = g

        frame = gtk.Frame(name)

        vb = gtk.VBox()
        vb.pack_start(g, True, True)

        tweak = None
        if adjustable:
            tweak = g.get_scroll_rate_widget()
            vb.pack_start(tweak.widget, False, False)

        frame.add(vb)
        self.pack_start(frame)

        vb = gtk.VBox()

        bbox = gtk.VButtonBox()
        bbox.set_layout(gtk.BUTTONBOX_END)
        vb.pack_start(bbox, True, True)

        if on_pause:
            b = gs.ui.get_button(stock=gtk.STOCK_MEDIA_PAUSE, xalign=0)
            b.connect("clicked", on_pause, tweak)
            bbox.pack_start(b, False, False)
        if on_print:
            b = gs.ui.get_button(stock=gtk.STOCK_PRINT, xalign=0)
            b.connect("clicked", on_print, g, name)
            bbox.pack_start(b, False, False)
        if on_remove:
            b = gs.ui.get_button(stock=gtk.STOCK_REMOVE, xalign=0)
            b.connect("clicked", on_remove, name)
            bbox.pack_start(b, False, False)
        if on_fullscreen:
            b = gs.ui.get_button(stock=gtk.STOCK_FULLSCREEN, xalign=0)
            b.connect("clicked", on_fullscreen, name)
            bbox.pack_start(b, False, False)
        if on_log_data:
            b = gs.ui.get_button("Log Message",
                                 image_stock=gtk.STOCK_FILE,
                                 xalign=0)
            b.connect("clicked", on_log_data, name)
            bbox.pack_start(b, False, False)

        if adjustable:
            r = _GraphRange(g)
            vb.pack_start(r, False, False)

        self.pack_start(vb, False, False)
        self.show_all()
Esempio n. 24
0
    def setup_gui(self):
        window = gtk.Window()
        cmbtmodl = gtk.ListStore(str, int)
        initview = gtk.TreeView(cmbtmodl)
        addcmbt = gtk.Button(stock=gtk.STOCK_ADD)
        startenc = gtk.Button("Start New Encounter")
        incinit = gtk.Button("+1 Init")
        decinit = gtk.Button("-1 Init")
        vbox1 = gtk.VBox()
        hbox1 = gtk.HBox()
        vbbox1 = gtk.VButtonBox()
        hbbox1 = gtk.HButtonBox()

        window.add(vbox1)
        vbox1.pack_start(hbox1)
        hbox1.pack_start(initview)
        hbox1.pack_start(vbbox1, expand=False)
        vbbox1.set_layout(gtk.BUTTONBOX_START)
        vbbox1.add(addcmbt)
        vbbox1.add(incinit)
        vbbox1.set_child_secondary(incinit, True)
        vbbox1.add(decinit)
        vbbox1.set_child_secondary(decinit, True)
        vbox1.pack_start(hbbox1, expand=False)
        hbbox1.add(startenc)

        window.connect('destroy', lambda w: gtk.main_quit())
        window.set_title("Initiator")
        window.show_all()
        cmbtmodl.set_sort_column_id(1, gtk.SORT_DESCENDING)
        initview.append_column(
            gtk.TreeViewColumn("Name", gtk.CellRendererText(), text=0))

        def initcell_cdf(column, cell, model, iter):
            cell.set_property("text", "%+d" % (model.get(iter, 1)[0], ))

        initcell = gtk.CellRendererText()
        initcol = gtk.TreeViewColumn("Init", initcell)
        initcol.set_cell_data_func(initcell, initcell_cdf)
        initview.append_column(initcol)
        for a, b in enumerate((True, False)):
            initview.get_column(a).set_expand(b)
        initview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
        addcmbt.connect('clicked', self.add_combatant)
        incinit.connect('clicked', self.change_initiative, 1)
        button_set_stock_image(incinit, gtk.STOCK_GO_UP)
        decinit.connect('clicked', self.change_initiative, -1)
        button_set_stock_image(decinit, gtk.STOCK_GO_DOWN)
        startenc.connect("clicked", self.new_encounter)

        self.window = window
        self.cmbtmodl = cmbtmodl
        self.initview = initview
Esempio n. 25
0
    def __init__ (self, dtype, props, key=None, parent=None,  help_text=''):
        BaseConfig.__init__ (self, dtype, props, key, parent)
        self.w = gtk.VBox (spacing = 6)
        h = gtk.HBox (spacing = 6)
        scroll = gtk.ScrolledWindow ()
        scroll.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        self.m = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
        self.v = gtk.TreeView(self.m)
        self.v.set_reorderable (True)
        self.v.set_headers_visible (False)
        rend = gtk.CellRendererText ()
        col = gtk.TreeViewColumn ('', rend, text=0)
        col.set_resizable(True)
        #col.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
        col.set_min_width(200)
        self.v.append_column (col)
        self.s = self.v.get_selection()
        self.s.connect ('changed', self.select_cb)
        
        scroll.add (self.v)
        h.pack_start (scroll, True, True)
        bbox = gtk.VButtonBox ()

        button = gtk.Button (_("Add"))
        bbox.pack_start (button)
        button.connect ('clicked', self.add_cb)
        button = gtk.Button (_("Update"))
        bbox.pack_start (button)
        button.connect ('clicked', self.update_cb)
        button = gtk.Button (_("Remove"))
        bbox.pack_start (button)
        button.connect ('clicked', self.remove_cb)

        self.m.connect ('row-changed', self._on_reordering)
        self.w.connect ('hide', self._on_leave)
        
        h.pack_end (bbox, False)
        self.w.pack_start (h, True)

        # Bottom
        self.subw = dtype.subtype.w (dtype.subtype, props, parent=self)
        self.w.pack_start (self.subw.w,
                           expand = self.subw.resize,
                           fill   = self.subw.resize)
        if self.key:
            data = Config.get (self.key).data
            self.set (data)
           
        self.w.show_all ()
        return
Esempio n. 26
0
    def __init__(self, ui):
        Dialog.__init__(self,
                        ui,
                        _('Templates'),
                        help='Help:Templates',
                        buttons=gtk.BUTTONS_CLOSE,
                        defaultwindowsize=(400, 450))
        # T: Dialog title

        label = gtk.Label()
        label.set_markup('<b>' + _('Templates') + '</b>')
        # T: Section in dialog
        label.set_alignment(0.0, 0.5)
        self.vbox.pack_start(label, False)

        hbox = gtk.HBox()
        self.vbox.add(hbox)

        self.view = TemplateListView()
        self.view.connect('row-activated', self.on_selection_changed)
        hbox.add(ScrolledWindow(self.view))

        vbbox = gtk.VButtonBox()
        vbbox.set_layout(gtk.BUTTONBOX_START)
        hbox.pack_start(vbbox, False)

        view_button = Button(stock='gtk-file',
                             label=_('_View'))  # T: button label
        view_button.connect('clicked', self.on_view)

        copy_button = Button(stock='gtk-copy')
        copy_button.connect('clicked', self.on_copy)

        edit_button = Button(stock='gtk-edit')
        edit_button.connect('clicked', self.on_edit)

        delete_button = gtk.Button(stock='gtk-remove')
        delete_button.connect('clicked', self.on_delete)

        for b in (view_button, copy_button, edit_button, delete_button):
            b.set_alignment(0.0, 0.5)
            vbbox.add(b)

        browse_button = Button(_('Browse'))  # T: button label
        browse_button.connect('clicked', self.on_browse)
        self.add_extra_button(browse_button)

        self._buttonbox = vbbox
        self._delete_button = delete_button
        self.on_selection_changed()
Esempio n. 27
0
def test_terminal(terminal_type_names, command_line, **kw):
    import gtk
    w = gtk.Window()
    b = gtk.VButtonBox()
    w.add(b)
    for tt in terminal_type_names:
        t, kw = make_terminal(tt, **kw)
        if t.widget is not None:
            t.widget.set_size_request(200, 200)
            b.pack_start(t.widget, expand=True)
        else:
            b.pack_start(gtk.Label('no widget for %s' % tt))
        t.execute(command_line, **kw)
    w.show_all()
    w.connect('destroy', lambda *a: gtk.main_quit())
    gtk.main()
Esempio n. 28
0
    def printbutton(self, vertical, spacing, layout):
        frame = gtk.Frame()

        bbox = gtk.VButtonBox()

        bbox.set_border_width(5)
        frame.add(bbox)

        bbox.set_layout(layout)
        bbox.set_spacing(spacing)

        button4 = gtk.Button("Print")
        button4.connect("clicked", self.printconfig)
        bbox.add(button4)

        return frame
Esempio n. 29
0
    def __init__(self):
        super(Tests, self).__init__()
        self.set_size_request(520, 240)
        self.set_border_width(8)

        table = gtk.Table(8, 5, False)
        table.set_col_spacings(3)

        self.tree_view_installed_tests = TestsView(_("Installed Tests"))
        table.attach(self.tree_view_installed_tests, 0, 1, 0, 3,
                     gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 1, 1)

        updatebtn = gtk.Button(_("Update"))
        updatebtn.connect('clicked', lambda w: self.update_test_mod())
        updatebtn.set_size_request(50, 30)
        table.attach(updatebtn, 0, 1, 3, 4, gtk.FILL | gtk.EXPAND, gtk.SHRINK,
                     1, 1)

        vbox = gtk.VBox()
        btnbox = gtk.VButtonBox()
        btnbox.set_border_width(5)
        btnbox.set_layout(gtk.BUTTONBOX_START)
        btnbox.set_spacing(5)
        button = gtk.Button(_("Add"))
        button.connect('clicked', lambda w: self.add_test())
        button.set_size_request(50, 30)
        btnbox.add(button)
        button = gtk.Button(_("Add All"))
        button.connect('clicked', lambda w: self.add_all())
        button.set_size_request(50, 30)
        btnbox.add(button)
        button = gtk.Button(_("Remove"))
        button.connect('clicked', lambda w: self.remove_test())
        button.set_size_request(50, 30)
        btnbox.add(button)
        button = gtk.Button(_("Remove All"))
        button.connect('clicked', lambda w: self.remove_all())
        button.set_size_request(50, 30)
        btnbox.add(button)
        table.set_row_spacing(1, 3)
        vbox.add(btnbox)
        table.attach(vbox, 3, 4, 1, 2, gtk.FILL, gtk.SHRINK, 1, 1)

        self.tree_view_selected_tests = TestsView(_("Selected Tests"))
        table.attach(self.tree_view_selected_tests, 4, 5, 1, 3)

        self.add(table)
Esempio n. 30
0
    def __init__(self, parent=None, size=(1920,1080)):
        self.superior = parent
        wprop = size[0]/1920.0
        hprop = size[1]/1080.0
        self.wprop = wprop
        self.hprop = hprop
        gtk.HBox.__init__(self, False, int(wprop*5))

        self.set_border_width(int(wprop*20))
        self.vbox = gtk.VBox(False,0)

        self.buttons = gtk.VButtonBox()
        self.buttons.set_layout(gtk.BUTTONBOX_START)
        self.buttons.set_spacing(int(wprop*5))

        scrolled = gtk.ScrolledWindow()
        scrolled.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        
        self.list,self.view = self.prepare_view()  
        self.view.get_selection().connect("changed",self.append_info)
        scrolled.add(self.view)

        sidebox = gtk.VBox(False,0)  
        frame = gtk.Frame()

        label= gtk.Label("Profile Tracks")
        alist = pango.AttrList()
        font = pango.FontDescription("bold "+str(int(self.hprop*15)))
        attr=pango.AttrFontDesc(font,0,-1)
        alist.insert(attr)
        label.set_attributes(alist)

        frame.set_label_widget(label)
        frame.set_label_align(0.5,0.5)
        frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        align=gtk.Alignment(1,0.5,0.95,0.9)
        self.sidetable = gtk.Table(homogeneous=True)
        self.sidetable.set_size_request(int(wprop*300),-1)
        align.add(self.sidetable)
        frame.add(align)

        self.vbox.pack_end(scrolled, True, True, 0)
        self.pack_start(self.vbox, True, True, 0)
        sidebox.pack_start(self.buttons, False, False, int(hprop*10))
        sidebox.pack_start(frame, False, False, int(hprop*15))
        self.pack_start(sidebox,False,False,int(wprop*15))