예제 #1
0
    def __init__(self):
        GladeWidget.__init__(self)

        self.connections.set_columns([
            Column("host",
                   title=_("Hostname"),
                   searchable=True,
                   ellipsize=ELLIPSIZE_MIDDLE,
                   expand=True,
                   width=100),
            Column("manager",
                   title=_("Manager"),
                   searchable=True,
                   ellipsize=ELLIPSIZE_END,
                   expand=True,
                   width=50),
            Column("timestamp",
                   title=_("Last used"),
                   sorted=True,
                   order=gtk.SORT_DESCENDING,
                   format_func=format_timestamp),
        ])
        self.connections.add_list(getRecentConnections())
        self.connections.get_treeview().set_search_equal_func(
            self._searchEqual)
        self.connections.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.connections.set_property('selection-mode', gtk.SELECTION_SINGLE)
        self.connections.set_size_request(-1, 160)

        self._updateButtons()
예제 #2
0
 def __init__(self, stdscr):
     self.stdscr = stdscr
     self.connections = getRecentConnections()
     self.current_connection = 0
     self.state = 0
     self.current_input = ''
     curses.curs_set(0)
     self.entries = ['', 'Hostname', 'Port', 'Secure?',
                      'Username', 'Password']
     self.inputs = ['', 'localhost', '7531', 'Yes', 'user', '']
예제 #3
0
 def __init__(self, stdscr):
     self.stdscr = stdscr
     self.connections = getRecentConnections()
     self.current_connection = 0
     self.state = 0
     self.current_input = ''
     curses.curs_set(0)
     self.entries = [
         '', 'Hostname', 'Port', 'Secure?', 'Username', 'Password'
     ]
     self.inputs = ['', 'localhost', '7531', 'Yes', 'user', '']
    def testGetRecentConnections(self):
        r = getRecentConnections()
        self.assertEquals(len(r), 2)

        # the recent connections are read in reverse lexicographical order
        ci2, ci1 = r[0].info, r[1].info
        self.assertEquals(ci1.port, 1234)
        self.assertEquals(ci1.host, 'test.host.com')
        self.assertEquals(ci1.use_ssl, False)
        self.assertEquals(ci1.authenticator.username, 'testuser')
        self.assertEquals(ci1.authenticator.password, 'testpasswd')
        self.assertEquals(ci2.port, 1235)
        self.assertEquals(ci2.host, 'test2.host.com')
        self.assertEquals(ci2.use_ssl, True)
        self.assertEquals(ci2.authenticator.username, 'test2user')
        self.assertEquals(ci2.authenticator.password, 'test2passwd')
예제 #5
0
    def testGetRecentConnections(self):
        r = getRecentConnections()
        self.assertEquals(len(r), 2)

        # the recent connections are read in reverse lexicographical order
        ci2, ci1 = r[0].info, r[1].info
        self.assertEquals(ci1.port, 1234)
        self.assertEquals(ci1.host, 'test.host.com')
        self.assertEquals(ci1.use_ssl, False)
        self.assertEquals(ci1.authenticator.username, 'testuser')
        self.assertEquals(ci1.authenticator.password, 'testpasswd')
        self.assertEquals(ci2.port, 1235)
        self.assertEquals(ci2.host, 'test2.host.com')
        self.assertEquals(ci2.use_ssl, True)
        self.assertEquals(ci2.authenticator.username, 'test2user')
        self.assertEquals(ci2.authenticator.password, 'test2passwd')
예제 #6
0
    def __init__(self):
        GladeWidget.__init__(self)

        columns = [
            Column("host", title=_("Hostname"), searchable=True),
            Column(
                "timestamp", title=_("Last used"), sorted=True, order=gtk.SORT_DESCENDING, format_func=format_timestamp
            ),
        ]
        self._connections = ObjectList(columns, objects=getRecentConnections(), mode=gtk.SELECTION_SINGLE)
        self._connections.connect("row-activated", self._on_objectlist_row_activated)
        self._connections.connect("selection-changed", self._on_objectlist_selection_changed)
        self._connections.set_size_request(-1, 160)
        self.page.pack_start(self._connections)
        self.page.reorder_child(self._connections, 0)
        self._connections.get_treeview().set_search_equal_func(self._searchEqual)
        self._connections.show()
        self._updateButtons()
예제 #7
0
    def __init__(self):
        GladeWidget.__init__(self)

        self.connections.set_columns(
                  [Column("host", title=_("Hostname"), searchable=True,
                          ellipsize=ELLIPSIZE_MIDDLE, expand=True, width=100),
                   Column("manager", title=_("Manager"), searchable=True,
                          ellipsize=ELLIPSIZE_END, expand=True, width=50),
                   Column("timestamp", title=_("Last used"),
                          sorted=True,
                          order=gtk.SORT_DESCENDING,
                          format_func=format_timestamp),
                   ])
        self.connections.add_list(getRecentConnections())
        self.connections.get_treeview().set_search_equal_func(
            self._searchEqual)
        self.connections.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.connections.set_property('selection-mode', gtk.SELECTION_SINGLE)
        self.connections.set_size_request(-1, 160)

        self._updateButtons()
예제 #8
0
 def testGetRecentConnections(self):
     recent = getRecentConnections()
     if not recent:
         return
     assert isinstance(recent[0], RecentConnection)