PyQT:重新启动插件时,我没有得到主 window 我得到了弹出 window

PyQT: When relaunching plugin I don't get the main window I get the pop up window

我正在使用 PyQTQGIS 上开发一个 python 插件。我的插件包含一个主 window 和一个弹出窗口 window,当单击主 window 上的按钮时将启动它们。

我的问题是当我再次启动插件时,将显示弹出窗口 window 而不是主要 window。

我在 Stack Overflow (launch a PyQT window from a main PyQt window, and get the user input?) 上找到了这个,但它无法帮助我解决问题。

你能帮帮我吗?

提前致谢。

编辑 添加代码 在我的主 window 中,我调用启动弹出窗口 window :

def show(self):

       self.project.load()

       if self.project.tranus_project:
           self.tranus_folder.setText(self.project.tranus_project.path)

       self.activate_launch_button()
       self.launch_options_TRANUS()
       super(OptionsTRANUSDialog, self).show()   

   ......
   def launch_options_TRANUS(self):

       self.get_checked_list()

       if self.checked_list != [] :

           dialog = launch_tranus_dialog.LaunchTRANUSDialog(self.checked_list,self.folder,self.tranus_binaries,parent=self)
           dialog.show()
           result = dialog.exec_()

       self.reinitialise_checked_list()

我的弹窗window的class定义为:

class LaunchTRANUSDialog(QtGui.QDialog, FORM_CLASS):

    def __init__(self,checked_list,project_directory,tranus_bin_path,parent=None):
        """Constructor."""
        super(LaunchTRANUSDialog, self).__init__(parent)
        self.setupUi(self)

        self.project = parent.project
        self.proj = QgsProject.instance()

        self.tranus_bin_path = tranus_bin_path
        self.project_directory = project_directory
        self.project = parent.project
        self.checked_list = checked_list
        self.is_all_checked = False

        self.tabs = self.findChild(QtGui.QTabWidget, 'tabWidget')

        self.proj = QgsProject.instance()
        #control actions
        self.tabs.blockSignals(True) 
        self.tabs.currentChanged.connect(self.onChange) 
        self.tabs.blockSignals(False) 

 def show(self):
        self.put_tabs()
        super(LaunchTRANUSDialog, self).show() 

我已经解决了我的问题,在我的主要 window 方法 show() 中我删除了 self.activate_launch_button() self.launch_options_TRANUS()