Example #1
0
    def __init__(self):
        builder = Gtk.Builder()
        builder.add_objects_from_file('app.glade', ('winConnections', ))

        self.window = builder.get_object('winConnections')

        self.connection_list = builder.get_object('listConnections')

        self.ent_host = builder.get_object('entHost')
        self.ent_port = builder.get_object('entPort')
        self.ent_user = builder.get_object('entUser')
        self.ent_password = builder.get_object('entPassword')
        self.ent_database = builder.get_object('entDatabase')
        self.ent_remote_host = builder.get_object('entRemoteHost')
        self.ent_remote_user = builder.get_object('entRemoteUser')
        self.file_remote_key = builder.get_object('fileRemoteKey')

        self.connections = Connections()

        for connection in self.connections.get_connections():
            self.connection_list.add(ListBoxRowWithData(connection))

        if self.connections.count() == 0:
            self.on_add_connection(None)

        builder.connect_signals({
            'onAddConnection': self.on_add_connection,
            'onListSelected': self.on_list_selected,
            'onRemoveConnection': self.on_remove_connection,
            'onSaveConnection': self.on_save_connection,
            'onConnect': self.on_connect
        })

        WindowManager.add_window(self.window)
        self.window.show_all()
Example #2
0
    def __init__(self, conn, tunnel):
        self.cursor = conn.cursor()

        self.last_detail_table = ''
        self.last_query_table = ''
        self.current_tab = 0
        self.current_page = 0
        self.current_table = ''
        self.store = None
        self.tunnel = tunnel

        builder = Gtk.Builder()
        builder.add_objects_from_file('app.glade', ('winQuery', ))

        builder.connect_signals({
            'on_table_row_selected': self.on_table_row_selected,
            'on_tab_selected': self.on_tab_selected,
            'on_previous_page': self.on_previous_page,
            'on_next_page': self.on_next_page,
            'on_filter_activate': self.on_filter_activate,
            'on_run_query': self.on_run_query,
            'on_data_key_press': self.on_data_key_press
        })

        self.query_tabs = builder.get_object('queryTabs')

        self.ent_data_filter = builder.get_object('entDataFilter')
        self.txt_query = builder.get_object('txtQuery')

        self.list_tables = builder.get_object('listTables')
        self.fetch_tables()

        self.data_view = DataView(builder.get_object('dataTree'), conn)
        self.query_view = QueryView(builder.get_object('queryTree'),
                                    builder.get_object('lblQueryInfo'), conn)

        self.window = builder.get_object('winQuery')
        WindowManager.add_window(self.window)
        self.window.show_all()