コード例 #1
0
ファイル: __init__.py プロジェクト: xguse/outspline
    def find_in_tree(self):
        sel = self.listview.GetFirstSelected()

        if sel > -1:
            for filename in core_api.get_open_databases():
                wxgui_api.unselect_all_items(filename)

            seldb = None
            warning = False

            # [1]: line repeated in the loop because of
            # wxgui_api.select_database_tab
            filename, id_ = self.itemdatamap[self.listview.GetItemData(sel)]

            while True:
                # It's necessary to repeat this line (see [1]) because
                # wxgui_api.select_database_tab must be executed only once
                # for the first selected item
                filename, id_ = self.itemdatamap[self.listview.GetItemData(
                                                                        sel)]

                # Check whether the database is still open and the item
                # still exists because the search results are retrieved in
                # a separate thread and are not updated together with the
                # database
                if core_api.is_database_open(filename) and \
                                        core_api.is_item(filename, id_):
                    wxgui_api.add_item_to_selection(filename, id_)

                    if seldb is None:
                        seldb = filename
                else:
                    warning = True

                sel = self.listview.GetNextSelected(sel)

                if sel < 0:
                    break

            if seldb:
                wxgui_api.select_database_tab(seldb)

                if warning:
                    msgboxes.some_items_not_found().ShowModal()
            elif warning:
                msgboxes.all_items_not_found().ShowModal()
コード例 #2
0
    def find_in_tree(self):
        sel = self.listview.GetFirstSelected()

        if sel > -1:
            for filename in core_api.get_open_databases():
                wxgui_api.unselect_all_items(filename)

            seldb = None
            warning = False

            # [1]: line repeated in the loop because of
            # wxgui_api.select_database_tab
            filename, id_ = self.itemdatamap[self.listview.GetItemData(sel)]

            while True:
                # It's necessary to repeat this line (see [1]) because
                # wxgui_api.select_database_tab must be executed only once
                # for the first selected item
                filename, id_ = self.itemdatamap[self.listview.GetItemData(
                    sel)]

                # Check whether the database is still open and the item
                # still exists because the search results are retrieved in
                # a separate thread and are not updated together with the
                # database
                if core_api.is_database_open(filename) and \
                                        core_api.is_item(filename, id_):
                    wxgui_api.add_item_to_selection(filename, id_)

                    if seldb is None:
                        seldb = filename
                else:
                    warning = True

                sel = self.listview.GetNextSelected(sel)

                if sel < 0:
                    break

            if seldb:
                wxgui_api.select_database_tab(seldb)

                if warning:
                    msgboxes.some_items_not_found().ShowModal()
            elif warning:
                msgboxes.all_items_not_found().ShowModal()