Example #1
0
    def _handle_enable_tree_menus(self, kwargs):
        filename = kwargs['filename']

        # filename is None is no database is open
        if filename:
            sel = wxgui_api.get_tree_selections(filename)

            if len(sel) == 1:
                self.mcut.Enable()
                self.mcopy.Enable()

                if copypaste_api.has_copied_items(filename):
                    self.mpaste.Enable()
                    self.mpaste.SetItemLabel(self.mpaste_label_2)
                    self.mpaste.SetHelp(self.mpaste_help_2)
                    self.mpastesub.Enable()

                else:
                    self.mpaste.Enable(False)
                    self.mpaste.SetItemLabel(self.mpaste_label_1)
                    self.mpaste.SetHelp(self.mpaste_help_1)
                    self.mpastesub.Enable(False)

            elif len(sel) > 1:
                self.mcut.Enable()
                self.mcopy.Enable(False)
                self.mcopy.Enable()
                self.mpaste.Enable(False)
                self.mpaste.SetItemLabel(self.mpaste_label_1)
                self.mpaste.SetHelp(self.mpaste_help_1)
                self.mpastesub.Enable(False)

            elif copypaste_api.has_copied_items(filename):
                self.mcut.Enable(False)
                self.mcopy.Enable(False)
                self.mpaste.Enable()
                self.mpaste.SetItemLabel(self.mpaste_label_1)
                self.mpaste.SetHelp(self.mpaste_help_1)
                self.mpastesub.Enable(False)

            else:
                self.mcut.Enable(False)
                self.mcopy.Enable(False)
                self.mpaste.Enable(False)
                self.mpaste.SetItemLabel(self.mpaste_label_1)
                self.mpaste.SetHelp(self.mpaste_help_1)
                self.mpastesub.Enable(False)

        else:
            self.mcut.Enable(False)
            self.mcopy.Enable(False)
            self.mpaste.Enable(False)
            self.mpaste.SetItemLabel(self.mpaste_label_1)
            self.mpaste.SetHelp(self.mpaste_help_1)
            self.mpastesub.Enable(False)
Example #2
0
    def _handle_popup_tree_context_menu(self, kwargs):
        filename = kwargs['filename']
        sel = wxgui_api.get_tree_selections(filename)

        if len(sel) == 1:
            self.cut.Enable()
            self.copy.Enable()

            if copypaste_api.has_copied_items(filename):
                self.paste.Enable()
                self.paste.SetItemLabel(self.cpaste_label_2)
                self.pastesub.Enable()

        elif len(sel) > 1:
            self.cut.Enable()
            self.copy.Enable()

        elif copypaste_api.has_copied_items(filename):
            self.paste.Enable()