def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() rddtDataExtractor.currentlyDownloading = False # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() else: # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False rddtDataExtractor.currentlyDownloading = False # reinstantiate the praw instance because it doesn't shelve properly # praw shelve issue causes http.validate_certs to be uninstantiated rddtDataExtractor._r = praw.Reddit(user_agent='Data Extractor for reddit v1.1 by /u/VoidXC') rddtDataExtractor._r.http.validate_certs = 'RedditDataExtractor/cacert.pem' queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() rddtDataExtractor.currentlyDownloading = False # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() else: # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False rddtDataExtractor.currentlyDownloading = False # reinstantiate the praw instance because it doesn't shelve properly # praw shelve issue causes http.validate_certs to be uninstantiated rddtDataExtractor._r = praw.Reddit( user_agent='Data Extractor for reddit v1.1 by /u/VoidXC') rddtDataExtractor._r.http.validate_certs = 'RedditDataExtractor/cacert.pem' queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())