@@ -193,8 +193,6 @@ def run(self):
193193 self .TYPEOFCONVERTORSIGNAL .emit (type_of_convertor )
194194
195195# check clipboard
196-
197-
198196class CheckClipBoardThread (QThread ):
199197
200198 CHECKCLIPBOARDSIGNAL = Signal ()
@@ -220,6 +218,21 @@ def run(self):
220218 old_clipboard = new_clipboard
221219
222220
221+ # check if any thing in clipboard or not
222+ class CheckClipboardStateThread (QThread ):
223+
224+ WINDOWISACTIVESIGNAL = Signal ()
225+
226+ def __init__ (self ):
227+ QThread .__init__ (self )
228+
229+ def run (self ):
230+ while (QApplication .clipboard ().text () == "" ):
231+ sleep (0.1 )
232+
233+ self .WINDOWISACTIVESIGNAL .emit ()
234+
235+
223236# check for newer version of Persepolis
224237class CheckNewerVersionThread (QThread ):
225238
@@ -4437,6 +4450,17 @@ def importText(self, menu=None):
44374450 # this method is importing download links from clipboard.
44384451 # clipboard must contain links.
44394452 def importLinksFromClipboard (self , menu = None ):
4453+
4454+ # show main window
4455+ self .showMainWindow ()
4456+
4457+ check_main_window_state_thread = CheckClipboardStateThread ()
4458+ self .threadPool .append (check_main_window_state_thread )
4459+ self .threadPool [- 1 ].start ()
4460+ self .threadPool [- 1 ].WINDOWISACTIVESIGNAL .connect (
4461+ self .importLinksFromClipboard2 )
4462+
4463+ def importLinksFromClipboard2 (self ):
44404464 # get links from clipboard
44414465 clipboard = QApplication .clipboard ().text ()
44424466
0 commit comments