Exemplo n.º 1
0
    def reset_print_menu(self):
        self.DestroyId(self.ID_PRINT)

        self.printtb = wx.Menu()
        self.PrependMenu(self.ID_PRINT, "Print &databases", self.printtb)

        self.all_ = self.printtb.Append(self.ID_PRINT_ALL, 'All databases')
        wxgui_api.bind_to_menu(self.print_all_databases, self.all_)

        self.printtb.AppendSeparator()

        self.databases = {}

        for filename in core_api.get_open_databases():
            # Note that these IDs will grow progressively every time this menu
            # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
            # (Then, crash...)
            TEMP_ID_MENU = wx.NewId()
            TEMP_ID_ALL = wx.NewId()

            self.databases[filename] = {
                'menu': wx.Menu(),
                'all_': None,
                'tables': {}
            }

            self.printtb.AppendMenu(TEMP_ID_MENU, _os.path.basename(filename),
                                    self.databases[filename]['menu'])

            self.databases[filename]['all_'] = self.databases[filename][
                                    'menu'].Append(TEMP_ID_ALL, 'All tables')
            wxgui_api.bind_to_menu(self.print_all_tables_loop(filename),
                                   self.databases[filename]['all_'])

            self.databases[filename]['menu'].AppendSeparator()

            for table in core_api.select_all_table_names(filename):
                # Note that these IDs will grow progressively every time this
                # menu is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
                # (Then, crash...)
                TEMP_ID = wx.NewId()
                self.databases[filename]['tables'][table[0]] = \
                                    self.databases[filename]['menu'].Append(
                                    TEMP_ID, table[0])
                wxgui_api.bind_to_menu(self.print_table_loop(filename,
                                table[0]),
                                self.databases[filename]['tables'][table[0]])

        if self.databases:
            self.printtb.AppendSeparator()

        self.memory = {
            'menu': wx.Menu(),
            'all_': None,
            'tables': {}
        }

        self.printtb.AppendMenu(self.ID_PRINT_MEMORY, ':memory:',
                                                        self.memory['menu'])

        self.memory['all_'] = self.memory['menu'].Append(
                                        self.ID_PRINT_MEMORY_ALL, 'All tables')
        wxgui_api.bind_to_menu(self.print_all_memory_tables,
                                                        self.memory['all_'])

        self.memory['menu'].AppendSeparator()

        for table in core_api.select_all_memory_table_names():
            # Note that these IDs will grow progressively every time this menu
            # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
            # (Then, crash...)
            TEMP_ID = wx.NewId()
            self.memory['tables'][table[0]] = self.memory['menu'].Append(
                                                            TEMP_ID, table[0])
            wxgui_api.bind_to_menu(self.print_memory_table_loop(table[0]),
                                   self.memory['tables'][table[0]])
Exemplo n.º 2
0
def print_memory_db():
    for table in core_api.select_all_memory_table_names():
        print_memory_table(table[0])
Exemplo n.º 3
0
    def reset_print_menu(self):
        self.DestroyId(self.ID_PRINT)

        self.printtb = wx.Menu()
        self.PrependMenu(self.ID_PRINT, "Print &databases", self.printtb)

        self.all_ = self.printtb.Append(self.ID_PRINT_ALL, 'All databases')
        wxgui_api.bind_to_menu(self.print_all_databases, self.all_)

        self.printtb.AppendSeparator()

        self.databases = {}

        for filename in core_api.get_open_databases():
            # Note that these IDs will grow progressively every time this menu
            # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
            # (Then, crash...)
            TEMP_ID_MENU = wx.NewId()
            TEMP_ID_ALL = wx.NewId()

            self.databases[filename] = {
                'menu': wx.Menu(),
                'all_': None,
                'tables': {}
            }

            self.printtb.AppendMenu(TEMP_ID_MENU, _os.path.basename(filename),
                                    self.databases[filename]['menu'])

            self.databases[filename]['all_'] = self.databases[filename][
                'menu'].Append(TEMP_ID_ALL, 'All tables')
            wxgui_api.bind_to_menu(self.print_all_tables_loop(filename),
                                   self.databases[filename]['all_'])

            self.databases[filename]['menu'].AppendSeparator()

            for table in core_api.select_all_table_names(filename):
                # Note that these IDs will grow progressively every time this
                # menu is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
                # (Then, crash...)
                TEMP_ID = wx.NewId()
                self.databases[filename]['tables'][table[0]] = \
                                    self.databases[filename]['menu'].Append(
                                    TEMP_ID, table[0])
                wxgui_api.bind_to_menu(
                    self.print_table_loop(filename, table[0]),
                    self.databases[filename]['tables'][table[0]])

        if self.databases:
            self.printtb.AppendSeparator()

        self.memory = {'menu': wx.Menu(), 'all_': None, 'tables': {}}

        self.printtb.AppendMenu(self.ID_PRINT_MEMORY, ':memory:',
                                self.memory['menu'])

        self.memory['all_'] = self.memory['menu'].Append(
            self.ID_PRINT_MEMORY_ALL, 'All tables')
        wxgui_api.bind_to_menu(self.print_all_memory_tables,
                               self.memory['all_'])

        self.memory['menu'].AppendSeparator()

        for table in core_api.select_all_memory_table_names():
            # Note that these IDs will grow progressively every time this menu
            # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!!
            # (Then, crash...)
            TEMP_ID = wx.NewId()
            self.memory['tables'][table[0]] = self.memory['menu'].Append(
                TEMP_ID, table[0])
            wxgui_api.bind_to_menu(self.print_memory_table_loop(table[0]),
                                   self.memory['tables'][table[0]])
Exemplo n.º 4
0
def print_memory_db():
    for table in core_api.select_all_memory_table_names():
        print_memory_table(table[0])