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

        self.bus = bus

        logger.debug('Running...')
        self.label = Label('Looking for Presence Service...')
        self.errors = ListStore(str)

        errors_tree = TreeView(model=self.errors)
        errors_tree.insert_column_with_attributes(0,
                                                  'Log',
                                                  CellRendererText(),
                                                  text=0)
        scroller = ScrolledWindow()
        scroller.add(errors_tree)

        self.paned = VPaned()
        self.paned.pack1(scroller)

        self.pack_start(self.label, False, False)
        self.pack_end(self.paned)

        bus.watch_name_owner(PS_NAME, self.on_name_owner_change)
        self.ps_watcher = Label('-')
        self.paned.pack2(self.ps_watcher)

        self.show_all()
 def __init__(self, value=None):
     super(MDSplusMethodWidget, self).__init__(rows=4,
                                               columns=2,
                                               homogeneous=False)
     self.device = Entry()
     self.method = Entry()
     self.args = list()
     self.argTable = Table(rows=8, columns=2, homogeneous=False)
     for i in range(8):
         self.args.append(Entry())
         self.argTable.attach(Label("Arg %d:       " % (i + 1, )), 0, 1, i,
                              i + 1, 0, 0)
         self.argTable.attach(self.args[i], 1, 2, i, i + 1, EXPAND | FILL,
                              0)
     self.scrolledWindow = ScrolledWindow()
     self.scrolledWindow.add_with_viewport(self.argTable)
     self.scrolledWindow.set_policy(POLICY_NEVER, POLICY_ALWAYS)
     adj = self.scrolledWindow.get_vadjustment()
     adj.connect("changed", adj_changed)
     self.timeout = Entry()
     self.attach(Label("Device:"), 0, 1, 0, 1, 0, 0)
     self.attach(self.device, 1, 2, 0, 1, EXPAND | FILL, 0)
     self.attach(Label("Method:"), 0, 1, 1, 2, 0, 0)
     self.attach(self.method, 1, 2, 1, 2, EXPAND | FILL, 0)
     self.attach(self.scrolledWindow, 0, 2, 2, 3)
     self.attach(Label("Timeout:"), 0, 1, 3, 4, 0, 0)
     self.attach(self.timeout, 1, 2, 3, 4, EXPAND | FILL, 0)
     self.set_row_spacings(5)
     self.value = value
Exemplo n.º 3
0
    def _setup_layout(self):

        hpaned = HPaned()
        label = Label(_("Are you sure you want to install/remove those packages?"))
        label.show()
        inst_frame = Frame(_("Packages to install"))
        rem_frame = Frame(_("Packages to remove"))

        inst_scroll = ScrolledWindow()
        inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)

        rem_scroll = ScrolledWindow()
        rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)

        inst_scroll.add(self.install_tree)
        rem_scroll.add(self.remove_tree)
        
        inst_frame.add(inst_scroll)
        rem_frame.add(rem_scroll)

        hpaned.pack1(inst_frame, False, False)
        hpaned.pack2(rem_frame, False, False)
        
        hpaned.show_all()

        self.vbox.pack_start(label, False, False, 0)
        self.vbox.pack_start(hpaned, True, True, 0)
        self.set_default_size(600,300)
        return
Exemplo n.º 4
0
class Dan:
    def __init__(self):
        self.url = "http://www.bibud.com"
        self.setupWindow()
        self.setupBrowser()
        main()

    def setupWindow(self):
        self.window_title = "Bibud"
        self.window = Window()
        self.window.show()
        self.window.connect("destroy-event", self.browser_quit)
        self.window.resize(1024, 768)
        self.window.set_title(self.window_title)

    def setupBrowser(self):
        self.browser = WebView()
        self.browser.show()
        self.browser.open(self.url)
        self.scroller = ScrolledWindow()
        self.scroller.add(self.browser)
        self.window.add(self.scroller)
        self.browser.connect("title-changed", self.title_changed)
        self.scroller.show()

    def eTitleChanged(self, webview, frame, title):
        self.window.set_title(title)

    def eQuit(self):
        main_quit()
Exemplo n.º 5
0
    def _setup_layout(self):

        self.set_default_size(600,200)
        label = Label(_("Are you sure you want to install/remove those packages?\n"))
        self.hpaned = HPaned()
        
        inst_scroll = ScrolledWindow()
        inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)

        rem_scroll = ScrolledWindow()
        rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        
        inst_scroll.add(self.install_tree)
        rem_scroll.add(self.remove_tree)
        
        self.hpaned.pack1(inst_scroll, False, False)
        self.hpaned.pack2(rem_scroll, False, False)
    
        self.vbox.pack_start( label, False, False, 0 )
        self.vbox.pack_start( self.hpaned, True, True, 0 )
        self.vbox.pack_start( self.expander, False, False, 0 )
        
        self.show_all()
        self.expander.hide_all()
        self.close_button.hide()
Exemplo n.º 6
0
class Dan:
	def __init__(self):
		self.url = "http://www.bibud.com"
		self.setupWindow()
		self.setupBrowser()
		main()
	def setupWindow(self):
		self.window_title = "Bibud"
		self.window = Window()
		self.window.show()
		self.window.connect("destroy-event", self.browser_quit)
		self.window.resize(1024,768)
		self.window.set_title(self.window_title)
	def setupBrowser(self):
		self.browser = WebView()
		self.browser.show()
		self.browser.open(self.url)
		self.scroller = ScrolledWindow()
		self.scroller.add(self.browser)
		self.window.add(self.scroller)
		self.browser.connect("title-changed", self.title_changed)
		self.scroller.show()
	def eTitleChanged(self, webview, frame, title):
		self.window.set_title(title)
	def eQuit(self):
		main_quit()
Exemplo n.º 7
0
 def __init__(self):
     ScrolledWindow.__init__(self)
     MDSplusWidget.__init__(self)
     tv = TextView()
     tv.set_wrap_mode(WRAP_WORD)
     self.buffer = tv.get_buffer()
     self.add(tv)
Exemplo n.º 8
0
    def __init__(self):
        '''
        Constructor
        '''
        cellRendererText = CellRendererText()

        treeViewColumn = TreeViewColumn()
        treeViewColumn.pack_start(cellRendererText)

        treeView = TreeView()
        treeView.append_column(treeViewColumn)

        scrolledWindow = ScrolledWindow()
        scrolledWindow.add(treeView)

        btnAdd_Alternative = Button()
        btnDel_Alternative = Button()

        hButtonBox = HButtonBox()
        hButtonBox.pack_start(btnAdd_Alternative)
        hButtonBox.pack_start(btnDel_Alternative)

        vBox = VBox()
        vBox.pack_start(scrolledWindow)
        vBox.pack_start(hButtonBox)

        self.add(vBox)
Exemplo n.º 9
0
 def __init__(self):
     ScrolledWindow.__init__(self)
     MDSplusWidget.__init__(self)
     tv = TextView()
     tv.set_wrap_mode(WRAP_WORD)
     self.buffer = tv.get_buffer()
     self.add(tv)
Exemplo n.º 10
0
 def __init__(self, conn):
     ScrolledWindow.__init__(self)
     self.conn = conn
     self.editor = TemplateEditor()
     self.menu = SimpleMenu()
     self.editor.connect('populate-popup', self.populate_menu, self.menu)
     self.add_with_viewport(self.editor)
     self.show()
Exemplo n.º 11
0
 def __init__(self, conn):
     ScrolledWindow.__init__(self)
     self.conn = conn
     self.editor = TemplateEditor()
     self.menu = SimpleMenu()
     self.editor.connect('populate-popup', self.populate_menu, self.menu)
     self.add_with_viewport(self.editor)
     self.show()
Exemplo n.º 12
0
 def __init__(self, data, name='RecordBox'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.vbox = VBox()
     self.add_with_viewport(self.vbox)
     HasRecordBox.__init__(self, self.vbox, data, name=name)
     self.vbox.show()
     self.show()
     self.vbox.set_events(BUTTON_PRESS_MASK)
Exemplo n.º 13
0
    def __init__(self):

        ScrolledWindow.__init__(self)

        self.set_policy(POLICY_NEVER, POLICY_ALWAYS)

        self.box = VBox()

        self.add_with_viewport(self.box)
Exemplo n.º 14
0
 def __init__(self):
     
     ScrolledWindow.__init__(self)
     
     self.set_policy(POLICY_NEVER, POLICY_ALWAYS)
     
     self.box = VBox()
     
     self.add_with_viewport(self.box)
Exemplo n.º 15
0
 def __init__(self):
     CommandBoxWindow.__init__(self)
     self.scroll = ScrolledWindow()
     self.vbox.add(self.scroll)
     self.scroll.show()
     if hasattr(self, 'menu'):
         HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
     else:
         HasListbox.__init__(self, self.scroll)
Exemplo n.º 16
0
 def __init__(self, data, name='RecordBox'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.vbox = VBox()
     self.add_with_viewport(self.vbox)
     HasRecordBox.__init__(self, self.vbox, data, name=name)
     self.vbox.show()
     self.show()
     self.vbox.set_events(BUTTON_PRESS_MASK)
Exemplo n.º 17
0
 def setupBrowser(self):
     self.browser = WebView()
     self.browser.show()
     self.browser.open(self.url)
     self.scroller = ScrolledWindow()
     self.scroller.add(self.browser)
     self.window.add(self.scroller)
     self.browser.connect("title-changed", self.title_changed)
     self.scroller.show()
Exemplo n.º 18
0
class ListWin(CommandBoxWindow, HasDialogs, HasListbox):
    def __init__(self):
        CommandBoxWindow.__init__(self)
        self.scroll = ScrolledWindow()
        self.vbox.add(self.scroll)
        self.scroll.show()
        if hasattr(self, 'menu'):
            HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
        else:
            HasListbox.__init__(self, self.scroll)
Exemplo n.º 19
0
class CList(Dialog, HasListbox):
    def __init__(self, message, name='MyCListDialog',
                 dnd=None, targets=[]):
        Dialog.__init__(self, message, name=name)
        self.set_name(name)
        self.scroll = ScrolledWindow()
        HasListbox.__init__(self, self.scroll, name=name,
                            dnd=dnd, targets=targets)
        self.scroll.show()
        self.vbox.pack_start(self.scroll, TRUE, TRUE, 0)
        self.set_size_request(150, 300)
Exemplo n.º 20
0
 def __init__(self, message, name='MyCListDialog', dnd=None, targets=[]):
     Dialog.__init__(self, message, name=name)
     self.set_name(name)
     self.scroll = ScrolledWindow()
     HasListbox.__init__(self,
                         self.scroll,
                         name=name,
                         dnd=dnd,
                         targets=targets)
     self.scroll.show()
     self.vbox.pack_start(self.scroll, TRUE, TRUE, 0)
     self.set_size_request(150, 300)
Exemplo n.º 21
0
 def __init__(self, text, font=None, name='TextScroll'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.tview = TextView()
     self.tview.set_name(name)
     self.tbuffer = self.tview.get_buffer()
     self.add(self.tview)
     self.tview.set_editable(0)
     self.tview.set_wrap_mode(WRAP_WORD)
     self.tbuffer.set_text(text)
     self.tview.show()
     self.show()
Exemplo n.º 22
0
 def __init__(self, message, name='MyScrollBox', type='v'):
     Dialog.__init__(self, message, name=name)
     self.scroll = ScrolledWindow()
     self.scroll.show()
     self.vbox.pack_start(self.scroll, TRUE, TRUE, 0)
     self.set_size_request(150, 300)
     if type == 'v':
         self.mbox = VBox()
     else:
         self.mbox = HBox()
     self.scroll.add_with_viewport(self.mbox)
     self.mbox.show()
Exemplo n.º 23
0
 def __init__(self, text, font=None, name='TextScroll'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.tview = TextView()
     self.tview.set_name(name)
     self.tbuffer = self.tview.get_buffer()
     self.add(self.tview)
     self.tview.set_editable(0)
     self.tview.set_wrap_mode(WRAP_WORD)
     self.tbuffer.set_text(text)
     self.tview.show()
     self.show()
Exemplo n.º 24
0
class _ScrollBox(Dialog):
    def __init__(self, message, name='MyScrollBox', type='v'):
        Dialog.__init__(self, message, name=name)
        self.scroll = ScrolledWindow()
        self.scroll.show()
        self.vbox.pack_start(self.scroll, TRUE, TRUE, 0)
        self.set_size_request(150, 300)
        if type =='v':
            self.mbox = VBox()
        else:
            self.mbox = HBox()
        self.scroll.add_with_viewport(self.mbox)
        self.mbox.show()
Exemplo n.º 25
0
 def __init__(self, name='_LeftListView'):
     VPaned.__init__(self)
     self.set_name(name)
     self.scroll = ScrolledWindow()
     self.add1(self.scroll)
     self.scroll.show()
     if hasattr(self, 'menu'):
         HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
     else:
         HasListbox.__init__(self, self.scroll)
     self.set_size_request(300, 200)
     self.set_position(140)
     self.show()
Exemplo n.º 26
0
class _TopListView(VPaned, HasListbox, HasDialogs):
    def __init__(self, name='_LeftListView'):
        VPaned.__init__(self)
        self.set_name(name)
        self.scroll = ScrolledWindow()
        self.add1(self.scroll)
        self.scroll.show()
        if hasattr(self, 'menu'):
            HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
        else:
            HasListbox.__init__(self, self.scroll)
        self.set_size_request(300,200)
        self.set_position(140)
        self.show()
Exemplo n.º 27
0
    def _setup_layout(self):

        self.set_default_size(-1,250)
        
        label = Label(_("This packages requires one of the packages you've selected for removal.\nDo you want to remove them all?"))
        label.show()

        scr = ScrolledWindow()
        scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        scr.add(self.tree)

        self.vbox.pack_start(label, False, False, 0)
        self.vbox.pack_start(scr, True, True, 0)
        self.vbox.show_all()
        return
Exemplo n.º 28
0
    def _setup_layout(self):
        self.set_default_size (300, 300)
        label = Label(_("Are you sure you want to upgrade those packages?\n"))
    
        scr = ScrolledWindow()
        scr.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        scr.add(self.tree)
        
        self.vbox.pack_start( label, False, False, 0)
        self.vbox.pack_start( scr, True, True, 0)
        self.vbox.pack_start( self.expander, False, False, 0)

        self.vbox.show_all()
        self.expander.hide_all()
        self.close_button.hide()
Exemplo n.º 29
0
 def __init__(self):
     ScrolledWindow.__init__(self)
     MDSplusWidget.__init__(self)
     self.numChannels = 4
     self.nodesPerChannel = 3
     self.dataNidOffset = 1
     self.startIdxNidOffset = 2
     self.endIdxNidOffset = 3
     self.incNidOffset = -1
     self.table = Table(homogeneous=False)
     self.table.set_row_spacings(0)
     self.add_with_viewport(self.table)
     self.set_policy(POLICY_NEVER, POLICY_ALWAYS)
     adj = self.get_vadjustment()
     if adj is not None:
         adj.connect("changed", self.adj_changed)
Exemplo n.º 30
0
 def __init__(self,value=None):
     super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
     self.image=Entry()
     self.routine=Entry()
     self.args=list()
     self.argTable=Table(rows=8,columns=2,homogeneous=False)
     for i in range(8):
         self.args.append(Entry())
         self.argTable.attach(Label("Arg %d:     " % (i+1,)),0,1,i,i+1,0,0)
         self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
     self.scrolledWindow=ScrolledWindow()
     self.scrolledWindow.add_with_viewport(self.argTable)
     self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
     adj=self.scrolledWindow.get_vadjustment()
     adj.connect("changed",adj_changed)
     self.timeout=Entry()
     self.attach(Label("Library:"),0,1,0,1,0,0)
     self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
     self.attach(Label("Routine:"),0,1,1,2,0,0)
     self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
     self.attach(self.scrolledWindow,0,2,2,3)
     self.attach(Label("Timeout:"),0,1,3,4,0,0)
     self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
     self.set_row_spacings(5)
     self.value=value
Exemplo n.º 31
0
 def __init__(self):
     ScrolledWindow.__init__(self)
     MDSplusWidget.__init__(self)
     self.numChannels=4
     self.nodesPerChannel=3
     self.dataNidOffset=1
     self.startIdxNidOffset=2
     self.endIdxNidOffset=3
     self.incNidOffset=-1
     self.table=Table(homogeneous=False)
     self.table.set_row_spacings(0)
     self.add_with_viewport(self.table)
     self.set_policy(POLICY_NEVER,POLICY_ALWAYS)
     adj=self.get_vadjustment()
     if adj is not None:
         adj.connect("changed",self.adj_changed)
Exemplo n.º 32
0
    def _setup_layout(self):
        self.vbox = VBox(False, 0)
        self.vbox.show()

        self.terminal = terminal()
        self.terminal.connect("child-exited", lambda _: self.close_button.show())
        
        self.expander = expander_new_with_mnemonic(_("_Terminal"))
        self.expander.set_expanded(False)
        self.expander.add(self.terminal)
        self.expander.show_all()
        
        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        scr = ScrolledWindow()
        scr.set_policy ("automatic", "automatic")
        scr.add (self.tree)
        scr.show()

        vpaned = VPaned()
        vpaned.add1(scr)
        vpaned.add2(self.expander)
        vpaned.set_position (260)
        vpaned.show()

        self.vbox.pack_start(vpaned, True, True, 0)
        self.vbox.pack_start(self.close_button, False, False, 0)

        self.add(self.vbox)
        return
Exemplo n.º 33
0
    def _setup_layout(self, conflict):

        self.set_default_size(-1,250)
        
        if not conflict:
            label = Label(_("These packages are required by package(s) you've selected for removal.\nDo you want to remove them all?"))
        else:
            label = Label("Package(s) that are about to be installed conflicts \nwith package(s) that are already installed.\nDo you want to remove them?")
        label.show()

        scr = ScrolledWindow()
        scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        scr.add(self.tree)

        self.vbox.pack_start(label, False, False, 0)
        self.vbox.pack_start(scr, True, True, 0)
        self.vbox.show_all()
        return
Exemplo n.º 34
0
	def setupBrowser(self):
		self.browser = WebView()
		self.browser.show()
		self.browser.open(self.url)
		self.scroller = ScrolledWindow()
		self.scroller.add(self.browser)
		self.window.add(self.scroller)
		self.browser.connect("title-changed", self.title_changed)
		self.scroller.show()
Exemplo n.º 35
0
 def __init__(self):
     CommandBoxWindow.__init__(self)
     self.scroll = ScrolledWindow()
     self.vbox.add(self.scroll)
     self.scroll.show()
     if hasattr(self, "menu"):
         HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
     else:
         HasListbox.__init__(self, self.scroll)
Exemplo n.º 36
0
    def add_tab(self, widget, tab_name, label):
        """Adds a tab object to the notebook."""
        log.debug('add tab: %s', tab_name)
        self.tabs[tab_name] = widget
        scrolled = ScrolledWindow()
        scrolled.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        scrolled.add(widget)
        self.notebook.insert_page(scrolled, Label(label), -1)
        scrolled.show_all()

        self.after_update()
Exemplo n.º 37
0
def create_scrollwin():
	from gtk import ScrolledWindow, POLICY_AUTOMATIC
	from gtk import SHADOW_IN
	scrollwin = ScrolledWindow()
	scrollwin.set_border_width(1)
	scrollwin.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
	scrollwin.set_shadow_type(SHADOW_IN)
	return scrollwin
Exemplo n.º 38
0
    def __init__(self):
        ScrolledWindow.__init__(self)

        self.set_policy(POLICY_ALWAYS, POLICY_ALWAYS)

        self.table = Table(3, 3)
        self.hRuler = HRuler()
        self.vRuler = VRuler()
        self.canvas = Canvas()

        self.canvas.connect('size-allocate', self.area_allocate, None)
        self.canvas.connect('motion-notify-event', self.area_motion, None)

        self.table.attach(self.hRuler, 1, 2, 0, 1, SHRINK | FILL,
                          SHRINK | FILL)
        self.table.attach(self.vRuler, 0, 1, 1, 2, SHRINK | FILL,
                          SHRINK | FILL)
        self.table.attach(self.canvas, 1, 2, 1, 2)

        self.add_with_viewport(self.table)
Exemplo n.º 39
0
class MDSplusMethodWidget(Table):

    def __init__(self,value=None):
        super(MDSplusMethodWidget,self).__init__(rows=4,columns=2,homogeneous=False)
        self.device=Entry()
        self.method=Entry()
        self.args=list()
        self.argTable=Table(rows=8,columns=2,homogeneous=False)
        for i in range(8):
            self.args.append(Entry())
            self.argTable.attach(Label("Arg %d:       " % (i+1,)),0,1,i,i+1,0,0)
            self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
        self.scrolledWindow=ScrolledWindow()
        self.scrolledWindow.add_with_viewport(self.argTable)
        self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
        adj=self.scrolledWindow.get_vadjustment()
        adj.connect("changed",adj_changed)
        self.timeout=Entry()
        self.attach(Label("Device:"),0,1,0,1,0,0)
        self.attach(self.device,1,2,0,1,EXPAND|FILL,0)
        self.attach(Label("Method:"),0,1,1,2,0,0)
        self.attach(self.method,1,2,1,2,EXPAND|FILL,0)
        self.attach(self.scrolledWindow,0,2,2,3)
        self.attach(Label("Timeout:"),0,1,3,4,0,0)
        self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
        self.set_row_spacings(5)
        self.value=value

    def getValue(self):
        ans=Method()
        ans.method=self.method.get_text()
        try:
            ans.method=Data.compile(ans.method)
        except Exception,e:
            pass
        try:
            ans.object=Data.compile(self.device.get_text())
        except Exception,e:
            msg="Invalid device specified.\n\n%s" % (e,)
            MDSplusErrorMsg('Invalid Device',msg)
            raise
Exemplo n.º 40
0
 def __init__(self, name="_LeftListView"):
     VPaned.__init__(self)
     self.set_name(name)
     self.scroll = ScrolledWindow()
     self.add1(self.scroll)
     self.scroll.show()
     if hasattr(self, "menu"):
         HasListbox.__init__(self, self.scroll, rcmenu=self.menu)
     else:
         HasListbox.__init__(self, self.scroll)
     self.set_size_request(300, 200)
     self.set_position(140)
     self.show()
Exemplo n.º 41
0
    def _setup_layout(self):

        self.set_default_size(600,200)
        self.hpaned = HPaned()
        
        inst_scroll = ScrolledWindow()
        inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)

        rem_scroll = ScrolledWindow()
        rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        
        inst_scroll.add(self.inst_tree)
        rem_scroll.add(self.rem_tree)
        
        self.hpaned.pack1(inst_scroll, False, False)
        self.hpaned.pack2(rem_scroll, False, False)
        self.hpaned.show_all()

        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        self.terminal = terminal()
        self.terminal.connect("child-exited", lambda _: self.close_button.show())

        self.expander = Expander(_("Terminal"))
        self.expander.connect("notify::expanded", self._set_size)
        self.expander.show()

        self.vbox = VBox(False, 0)
        self.vbox.show()
        
        self.vbox.pack_start(self.hpaned, True, True, 0)
        self.vbox.pack_start(self.expander, False, False, 0)
        self.vbox.pack_start(self.close_button, False, False, 0)

        
        self.add(self.vbox)
Exemplo n.º 42
0
    def _setup_layout(self):

        self.label = Label(_("Are you sure yo want to upgrade those packages?\n"))
        self.label.show()

        self.set_default_size (300, 300)

        scr = ScrolledWindow()
        scr.set_policy("automatic", "automatic")
        scr.add(self.tree)
        scr.show()
        
        self.vbox.pack_start(self.label, False, False, 0)
        self.vbox.pack_start(scr, True, True, 0)
class MDSplusMethodWidget(Table):
    def __init__(self, value=None):
        super(MDSplusMethodWidget, self).__init__(rows=4,
                                                  columns=2,
                                                  homogeneous=False)
        self.device = Entry()
        self.method = Entry()
        self.args = list()
        self.argTable = Table(rows=8, columns=2, homogeneous=False)
        for i in range(8):
            self.args.append(Entry())
            self.argTable.attach(Label("Arg %d:       " % (i + 1, )), 0, 1, i,
                                 i + 1, 0, 0)
            self.argTable.attach(self.args[i], 1, 2, i, i + 1, EXPAND | FILL,
                                 0)
        self.scrolledWindow = ScrolledWindow()
        self.scrolledWindow.add_with_viewport(self.argTable)
        self.scrolledWindow.set_policy(POLICY_NEVER, POLICY_ALWAYS)
        adj = self.scrolledWindow.get_vadjustment()
        adj.connect("changed", adj_changed)
        self.timeout = Entry()
        self.attach(Label("Device:"), 0, 1, 0, 1, 0, 0)
        self.attach(self.device, 1, 2, 0, 1, EXPAND | FILL, 0)
        self.attach(Label("Method:"), 0, 1, 1, 2, 0, 0)
        self.attach(self.method, 1, 2, 1, 2, EXPAND | FILL, 0)
        self.attach(self.scrolledWindow, 0, 2, 2, 3)
        self.attach(Label("Timeout:"), 0, 1, 3, 4, 0, 0)
        self.attach(self.timeout, 1, 2, 3, 4, EXPAND | FILL, 0)
        self.set_row_spacings(5)
        self.value = value

    def getValue(self):
        ans = Method()
        ans.method = self.method.get_text()
        try:
            ans.method = Data.compile(ans.method)
        except Exception:
            pass
        try:
            ans.object = Data.compile(self.device.get_text())
        except Exception:
            msg = "Invalid device specified.\n\n%s" % (sys.exc_info()[1], )
            MDSplusErrorMsg('Invalid Device', msg)
            raise
        if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
            ans.timeout = None
        else:
            try:
                ans.timeout = Data.compile(self.timeout.get_text())
            except Exception:
                msg = "Invalid timeout specified.\n\n%s" % (
                    sys.exc_info()[1], )
                MDSplusErrorMsg('Invalid Timeout', msg)
                raise
        idx = len(self.args) - 1
        found = False
        while idx >= 0:
            t = self.args[idx].get_text()
            if t == '':
                if found:
                    ans.setArgumentAt(idx, None)
            else:
                try:
                    a = Data.compile(t)
                except Exception:
                    msg = "Invalid argument (%d) specified.\n\n%s" % (
                        idx + 1,
                        sys.exc_info()[1],
                    )
                    MDSplusErrorMsg('Invalid Argument', msg)
                    raise
                ans.setArgumentAt(idx, a)
                found = True
            idx = idx - 1
        return ans

    def setValue(self, d):
        self._value = d
        self.reset()

    def reset(self):
        if isinstance(self._value, Method):
            self.method.set_text(self._value.method.decompile())
            self.device.set_text(self._value.object.decompile())
            if self._value.timeout is None:
                self.timeout.set_text('')
            else:
                self.timeout.set_text(self._value.timeout.decompile())
            idx = 0
            for arg in self.args:
                if self._value.getArgumentAt(idx) is None:
                    arg.set_text('')
                else:
                    arg.set_text(self._value.getArgumentAt(idx).decompile())
                idx = idx + 1
        else:
            self.method.set_text('')
            self.device.set_text('')
            self.timeout.set_text('')
            for arg in self.args:
                arg.set_text('')

    value = property(getValue, setValue)

    def show(self):
        old = self.get_no_show_all()
        self.set_no_show_all(False)
        self.show_all()
        self.set_no_show_all(old)
Exemplo n.º 44
0
    def __init__(self, bus, unique_name, log):
        VBox.__init__(self)

        self.bus = bus
        self.unique_name = unique_name
        self.proxy = bus.get_object(unique_name, PS_PATH)
        self.iface = dbus.Interface(self.proxy, PS_IFACE)
        self.log = log

        self.activities = None
        self.iface.connect_to_signal('ActivityAppeared',
                                     self._on_activity_appeared)
        self.iface.connect_to_signal('ActivityDisappeared',
                                     self._on_activity_disappeared)
        self.iface.GetActivities(reply_handler=self._on_get_activities_success,
                                 error_handler=self._on_get_activities_failure)

        self.buddies = None
        self.iface.connect_to_signal('BuddyAppeared', self._on_buddy_appeared)
        self.iface.connect_to_signal('BuddyDisappeared',
                                     self._on_buddy_disappeared)
        self.iface.GetBuddies(reply_handler=self._on_get_buddies_success,
                              error_handler=self._on_get_buddies_failure)

        # keep this in sync with the ACT_COL_ constants
        self.activities_list_store = ListStore(
            str,  # object path
            int,  # weight (bold if new)
            bool,  # strikethrough (dead)
            str,  # ID
            str,  # color
            str,  # type
            str,  # name
            str,  # conn
            str,  # channels
            str,  # buddies
        )

        self.pack_start(Label('Activities:'), False, False)

        self.activities_list = TreeView(self.activities_list_store)
        c = self.activities_list.insert_column_with_attributes(
            0,
            'Object path',
            CellRendererText(),
            text=ACT_COL_PATH,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_PATH)
        c = self.activities_list.insert_column_with_attributes(
            1,
            'ID',
            CellRendererText(),
            text=ACT_COL_ID,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_ID)
        c = self.activities_list.insert_column_with_attributes(
            2,
            'Color',
            CellRendererText(),
            text=ACT_COL_COLOR,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_COLOR)
        c = self.activities_list.insert_column_with_attributes(
            3,
            'Type',
            CellRendererText(),
            text=ACT_COL_TYPE,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_TYPE)
        c = self.activities_list.insert_column_with_attributes(
            4,
            'Name',
            CellRendererText(),
            text=ACT_COL_NAME,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_NAME)
        c = self.activities_list.insert_column_with_attributes(
            5,
            'Connection',
            CellRendererText(),
            text=ACT_COL_CONN,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(ACT_COL_CONN)
        c = self.activities_list.insert_column_with_attributes(
            6,
            'Channels',
            CellRendererText(),
            text=ACT_COL_CHANNELS,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)
        c = self.activities_list.insert_column_with_attributes(
            7,
            'Buddies',
            CellRendererText(),
            text=ACT_COL_BUDDIES,
            weight=ACT_COL_WEIGHT,
            strikethrough=ACT_COL_STRIKE)
        c.set_resizable(True)

        scroller = ScrolledWindow()
        scroller.add(self.activities_list)
        self.pack_start(scroller)

        # keep this in sync with the BUDDY_COL_ constants
        self.buddies_list_store = ListStore(str, int, bool, str, bool, str,
                                            str, str, str, str, str)

        self.pack_start(Label('Buddies:'), False, False)
        self.buddies_list = TreeView(self.buddies_list_store)
        c = self.buddies_list.insert_column_with_attributes(
            0,
            'Object path',
            CellRendererText(),
            text=BUDDY_COL_PATH,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_PATH)
        c = self.buddies_list.insert_column_with_attributes(
            1,
            'Pubkey',
            CellRendererText(),
            text=BUDDY_COL_KEY_ID,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_KEY_ID)
        c = self.buddies_list.insert_column_with_attributes(
            2,
            'Nick',
            CellRendererText(),
            text=BUDDY_COL_NICK,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_NICK)
        c = self.buddies_list.insert_column_with_attributes(
            3, 'Owner', CellRendererToggle(), active=BUDDY_COL_OWNER)
        c = self.buddies_list.insert_column_with_attributes(
            4,
            'Color',
            CellRendererText(),
            text=BUDDY_COL_COLOR,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_OWNER)
        c = self.buddies_list.insert_column_with_attributes(
            5,
            'IPv4',
            CellRendererText(),
            text=BUDDY_COL_IP4,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_IP4)
        c = self.buddies_list.insert_column_with_attributes(
            6,
            'CurAct',
            CellRendererText(),
            text=BUDDY_COL_CUR_ACT,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_CUR_ACT)
        c = self.buddies_list.insert_column_with_attributes(
            7,
            'Activities',
            CellRendererText(),
            text=BUDDY_COL_ACTIVITIES,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_ACTIVITIES)
        c = self.buddies_list.insert_column_with_attributes(
            8,
            'Handles',
            CellRendererText(),
            text=BUDDY_COL_HANDLES,
            weight=BUDDY_COL_WEIGHT,
            strikethrough=BUDDY_COL_STRIKE)
        c.set_resizable(True)
        c.set_sort_column_id(BUDDY_COL_HANDLES)

        scroller = ScrolledWindow()
        scroller.add(self.buddies_list)
        self.pack_start(scroller)

        self.iface.connect_to_signal('ActivityInvitation',
                                     self._on_activity_invitation)
        self.iface.connect_to_signal('PrivateInvitation',
                                     self._on_private_invitation)
Exemplo n.º 45
0
    def __init__(self,
                 trans, transid, plugin, gui_parent, change_register_function,
                 book, display_mode=TRANSACTION_ALL_EDIT_FIRST_TIME,
                 transaction_edit_finished_function=null_function):
        self.trans = trans
        self.transid = transid
        self.plugin = plugin
        self.gui_parent = gui_parent
        self.change_register_function = change_register_function
        self.book = book
        self.display_mode = display_mode
        self.transaction_edit_finished_function = (
            null_function if display_mode not in HEADLESS_MODES
            else transaction_edit_finished_function )

        self.hide_parent = Window()
        self.hide_parent.hide()
        self.mainvbox = VBox()
        self.hide_parent.add(self.mainvbox)

        config = self.trans.get_configuration_and_provide_on_load_hook()
        config_module_name = self.plugin.config_module_name
        if not config_valid(config):
            # even in the case of a broken config, we should still
            # display all of the data we have available...
            self.mainvbox.pack_start(Label("no configuration"))
        elif not self.trans.can_safely_proceed_with_config_module(config):
            # should display all data that's available instead of just
            # this label
            #
            # and should give
            # user an overide option where they either pick an old config
            # for one time use or just blow out the memory of having used
            # a different config...
            #
            # should also print the checksum itself so they know
            # what they need...
            #
            # perhaps eventually we even put in place some archival support
            # for saving old glade and config files and then code into the
            # the transaction -- hey, code you need to be editable is
            # over here..
            #
            # now hopefully there is no marking of this transaction dirty
            # in this mode and the extra safegaurds we put into
            # MultipageGladeTransaction don't get activated
            self.mainvbox.pack_start(
                Label("out of date configuration. data is read only here for "
                      "the safety of your old information, last adler "
                      "CRC was %s" % self.trans.config_crc_cache ))
        else:
            # if the safety cache was relied on before we need to tell the
            # backend that the transaction is actually dirty,
            # and now that we know that we have a workable config,
            # there's a chance that we'll actually be able to avoid
            # relying on the cache this time
            if self.trans.get_safety_cache_was_used():
                self.change_register_function()

            self.page_label = Label("")
            (x_align, y_align) = self.page_label.get_alignment()
            self.page_label.set_alignment(0.0, y_align)
            self.mainvbox.pack_start(self.page_label, expand=False)

            # establish maincontainer, which is where the actual glade
            # pages are put by attach_current_page
            #
            # The order of placement here is important, we place this
            # after page_label has already been added to main
            # and we also need to do this prior to attach_current_page
            # being called, as it depends on self.maincontainer being
            # there
            #
            # when we're in headless mode the maincontainer can just be
            # the mainvbox itself
            #
            # but, outside headless mode we save screen real-estate and
            # place a scrolled window (which becomes the maincontainer)
            # inside the mainvbox and the glade by glade pages end up
            # in there instead (again, in attach_current_page)
            if display_mode in HEADLESS_MODES:
                self.maincontainer = self.mainvbox
            else:
                self.maincontainer = Viewport()
                sw = ScrolledWindow()
                sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
                sw.add( self.maincontainer)
                self.mainvbox.pack_start(sw)

            self.glade_pages = [
                self.__setup_page(glade_file, top_glade_element)
                for glade_file, top_glade_element in config.pages ]
            self.glade_pages_by_ident_index = dict(
                ( (key, self.glade_pages[i])
                  for i, key in enumerate(config.pages)
                  ) # end generator expression
                ) # end dict
            
            self.__setup_auto_widgets()

            self.current_page = 0
            self.attach_current_page()

            button_hbox = HBox()
            self.mainvbox.pack_end(button_hbox, expand=False)
            self.nav_buts = dict( (Button(), i)
                                  for i in range(2) )
            for but, i in self.nav_buts.iteritems():
                but.set_property('use-stock', True)
                but.set_label( STOCK_GO_BACK
                               if i == GLADE_BACK_NAV else STOCK_GO_FORWARD )
                button_hbox.pack_start(but, expand=False)
                but.connect("clicked", self.nav_but_clicked)

            config.gui_initialization_hook(
                self, self.trans, self.plugin, self.book)

        self.mainvbox.show_all()
        self.mainvbox.reparent(self.gui_parent)
Exemplo n.º 46
0
 def __init__(self, rows=[], name='ScrollCList',
              columns=[], **args):
     ScrolledWindow.__init__(self)
     HasListbox.__init__(self, self, name=name, **args)
     self.show()
Exemplo n.º 47
0
 def __init__(self, rows=[], name='ScrollCList', columns=[], **args):
     ScrolledWindow.__init__(self)
     HasListbox.__init__(self, self, name=name, **args)
     self.show()
Exemplo n.º 48
0
 def __init__(self, all_fields, select_fun, name='ScrolledFieldBox'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.vbox = VBox()
     self.vbox.show()
     self.add_with_viewport(self.vbox)
Exemplo n.º 49
0
class MDSplusRoutineWidget(Table):

    def __init__(self,value=None):
        super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
        self.image=Entry()
        self.routine=Entry()
        self.args=list()
        self.argTable=Table(rows=8,columns=2,homogeneous=False)
        for i in range(8):
            self.args.append(Entry())
            self.argTable.attach(Label("Arg %d:     " % (i+1,)),0,1,i,i+1,0,0)
            self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
        self.scrolledWindow=ScrolledWindow()
        self.scrolledWindow.add_with_viewport(self.argTable)
        self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
        adj=self.scrolledWindow.get_vadjustment()
        adj.connect("changed",adj_changed)
        self.timeout=Entry()
        self.attach(Label("Library:"),0,1,0,1,0,0)
        self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
        self.attach(Label("Routine:"),0,1,1,2,0,0)
        self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
        self.attach(self.scrolledWindow,0,2,2,3)
        self.attach(Label("Timeout:"),0,1,3,4,0,0)
        self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
        self.set_row_spacings(5)
        self.value=value

    def getValue(self):
        ans=Routine()
        ans.image=self.image.get_text()
        try:
            ans.image=Data.compile(ans.image)
        except Exception:
            pass
        ans.routine=self.routine.get_text()
        try:
            ans.routine=Data.compile(ans.routine)
        except Exception:
            pass
        if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
            ans.timeout=None
        else:
            try:
                ans.timeout=Data.compile(self.timeout.get_text())
            except Exception:
                msg="Invalid timeout specified.\n\n%s" % (sys.exc_info(),)
                MDSplusErrorMsg('Invalid Timeout',msg)
                raise
        idx=len(self.args)-1
        found=False
        while idx >= 0:
            t = self.args[idx].get_text()
            if t == '':
                if found:
                    ans.setArgumentAt(idx,None)
            else:
                try:
                    a=Data.compile(t)
                except Exception:
                    msg="Invalid argument specified.\n\n%s" % (sys.exc_info(),)
                    MDSplusErrorMsg('Invalid Argument',msg)
                    raise
                ans.setArgumentAt(idx,a)
                found=True
            idx=idx-1
        return ans
        
    def setValue(self,d):
        self._value=d
        self.reset()


    def reset(self):
        if isinstance(self._value,Routine):
            self.image.set_text(self._value.image.decompile())
            self.routine.set_text(self._value.routine.decompile())
            if self._value.timeout is None or self._value.timeout.decompile() == '*':
                self.timeout.set_text('')
            else:
                self.timeout.set_text(self._value.timeout.decompile())
            idx=0
            for arg in self.args:
                if self._value.getArgumentAt(idx) is None:
                    arg.set_text('')
                else:
                    arg.set_text(self._value.getArgumentAt(idx).decompile())
                idx=idx+1
        else:
            self.image.set_text('')
            self.routine.set_text('')
            self.timeout.set_text('')
            for arg in self.args:
                arg.set_text('')

    value=property(getValue,setValue)

    def show(self):
        old=self.get_no_show_all()
        self.set_no_show_all(False)
        self.show_all()
        self.set_no_show_all(old)
Exemplo n.º 50
0
 def __init__(self, all_fields, select_fun, name='ScrolledFieldBox'):
     ScrolledWindow.__init__(self)
     self.set_name(name)
     self.vbox = VBox()
     self.vbox.show()
     self.add_with_viewport(self.vbox)