def __init__(self): if not os.path.exists(CacheManager.DIRECTORY): os.mkdir(CacheManager.DIRECTORY) if not SettingManager.checkBasicSettingFilesCompletion(): SettingManager.setUpBasicSettingFiles() super().__init__() self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle('Twitch chat') self.left = 500 self.top = 40 self.width = 500 self.height = 900 self.setGeometry(self.left, self.top, self.width, self.height) self.centralWidget = CentralWidget(self) self.setCentralWidget(self.centralWidget) menu = MenuBar(self) self.setMenuBar(menu) self.show()
def __init__(self, debug=False): super().__init__() self.setObjectName("Main_window") self.settings = None Utils.debug = debug # TODO SINGLETONS ?¿?¿?¿?¿ UI.instance = self UI.threadpool = QThreadPool() UI.DEBUG = debug # TODO SINGLETONS ?¿?¿?¿?¿ THEY ARE REALLY NEEDED? self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.connection = AuthConnection() self.login_form = GUI_Resources.get_login_register_dialog( self.connection) self.user_credentials = {"result": False} self.credentials() if self.user_credentials["result"]: if self.user_credentials["order"] == "login": self.show() elif self.user_credentials["order"] == "register": self.connection.register_user( self.user_credentials["username"], self.user_credentials["password"]) self.show() else: sys.exit(1) else: sys.exit(0) # Recogemos el Central widget, lo añadimos y luego lo inicializamos if debug: self.user_credentials["username"] = AuthConnection.default_user self.settings = UserSettings(self.user_credentials["username"]) self.setWindowTitle(self.settings.applicationName()) self.central = CentralWidgetParkingson( self.user_credentials["username"]) self.setCentralWidget(self.central) # Creamos el objeto settings if self.settings.value(self.settings.SIZE): rect = self.settings.value(self.settings.SIZE, type=QSize) self.resize(rect.width(), rect.height()) if self.settings.value(self.settings.FULLSCREEN, False, bool): self.showMaximized() pos = self.settings.value(self.settings.POSITION, QPoint(50, 50), QPoint) self.move(pos) PruebasListModel.get_instance(self.user_credentials["username"]) self.listview_model: AbstractEntityModel = PacientsListModel.get_instance( self.user_credentials["username"]) self.central.pacients_list_view.setModel(self.listview_model) self.setCentralWidget(self.central) self.menu_bar = MenuBar() self.status_bar = QStatusBar() self.toolbar = ToolBar() self.addToolBar(self.toolbar) self.setStatusBar(self.status_bar) self.setMenuBar(self.menu_bar) self.set_up_actions() self.central.pacients_list_view.clicked.connect( self.on_listview_pacient_click) self.central.pacients_list_view.doubleClicked.connect( self.on_pacient_double_click) self.central.pacients_tab.finishedSignal.connect(self.on_finished) self.central.pacients_tab.resultSignal.connect(self.on_result) self.central.cronometro_tab.finishedSignal.connect( self.on_crono_finished) self.changeStatusBar.connect(self.changeStatus) self.central.pacients_tab.set_signal_pacient_selected( self.pacientSelected) self.central.cronometro_tab.set_signal_pacient_selected( self.pacientSelected) self.central.evolution_tab.set_signal_pacient_selected( self.pacientSelected) self.central.pacients_tab.set_change_status_bar(self.changeStatusBar) self.central.cronometro_tab.set_change_status_bar(self.changeStatusBar) self.central.evolution_tab.set_change_status_bar(self.changeStatusBar) self.central.pacients_tab.set_key_pressed(self.key_press) self.central.cronometro_tab.set_key_pressed(self.key_press) self.central.evolution_tab.set_key_pressed(self.key_press) self.central.pacients_tab.set_signal_current_changed( self.central.parent_tab_widget.currentChanged) self.central.cronometro_tab.set_signal_current_changed( self.central.parent_tab_widget.currentChanged) self.central.evolution_tab.set_signal_current_changed( self.central.parent_tab_widget.currentChanged) self.central.evolution_tab.set_on_reload_signal(self.on_reload) self.central.pacients_tab.set_on_reload_signal(self.on_reload) self.central.cronometro_tab.set_on_reload_signal(self.on_reload) self.hideViews.connect(self.hide_view) self.menu_bar.view_pacientes.setCheckable(True) self.menu_bar.view_toolbar.setCheckable(True) self.menu_bar.view_crono.setCheckable(True) self.menu_bar.view_rendimiento.setCheckable(True) self.menu_bar.view_pacientes.setChecked(True) self.menu_bar.view_toolbar.setChecked(True) self.menu_bar.view_crono.setChecked(True) self.menu_bar.view_rendimiento.setChecked(True) self.menu_bar.view_pacientes.changed.connect(self.hide_view) self.menu_bar.view_toolbar.changed.connect(self.hide_view) self.menu_bar.view_crono.changed.connect(self.hide_view) self.menu_bar.view_rendimiento.changed.connect(self.hide_view) self.central.parent_tab_widget.setEnabled(False) # INIT Tab Components self.central.pacients_tab.init() self.central.cronometro_tab.init() self.central.evolution_tab.init() # El tab de pacientes sera el por defecto. pacient_index = self.central.parent_tab_widget.indexOf( self.central.pacients_tab) self.central.parent_tab_widget.setCurrentIndex(pacient_index) self.iconSizeChanged.connect(self.iconSizeChanged) threading.Thread(target=self.check_camera_worker).start() self.inited = True
def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.ConnectHelper = ConnectHelper() self.Basic_NLP_Tasks = Basic_NLP_Tasks() self.ConnAssistant = ConnAssistant() self.parent = parent self.twitterCollection = {} self.textCollection = {} self['highlightthickness'] = 2 self.parent['highlightthickness'] = 2 self.parent['relief'] = 'groove' ### NAVBAR ## # def hello(): print('Hello') MenuBar(parent, hello) ### HEADER FRAME ## CONTAINS: # headerFrame = tk.Frame(parent) headerFrame['highlightthickness'] = 2 headerFrame['relief'] = 'groove' totaltxt = ttk.Label(headerFrame, text="REAL TIME TWITTER EXPLORER", font=("Times", 20)) totaltxt.pack() headerFrame.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) ### TABS AND MAIN CONTENT ## # mainFrame = tk.Frame(parent) mainFrame.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) tabController = ttk.Notebook(mainFrame) rawTab = ttk.Frame(tabController) tabController.add(rawTab, text="Raw Text Tab") tweetTab = ttk.Frame(tabController) tabController.add(tweetTab, text="Get Tweets Tab") FacebookTab = ttk.Frame(tabController) tabController.add(FacebookTab, text="Facebook Tab") tabController.pack(expand=1, fill='both', padx=5, pady=5) ############################### EVERYTHING BELOW IS IN RAW TEXT TAB ############################### ### TREEVIEW ## rawTreeTab = tk.Frame(rawTab) path = "C:/Users/Y/Desktop/ny_styr/skeptics-texts/skeptics-texts" self.nodes = dict() frame = tk.Frame(rawTreeTab) self.tree = ttk.Treeview(frame, height=10) ttk.Style().configure("Treeview", background="#383838", foreground="#FFF") ysb = ttk.Scrollbar(frame, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(frame, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) self.tree.heading('#0', text="SELECT FILE", anchor='center') self.tree.pack(fill='x') frame.pack(fill='x') abspath = os.path.abspath(path) self.insert_node('', abspath, abspath) self.tree.bind('<<TreeviewOpen>>', self.open_node) self.tree.bind('<Double-1>', self.OnDoubleClick) rawTreeTab['highlightthickness'] = 2 rawTreeTab['relief'] = 'groove' rawTreeTab.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) rawLowerTab = tk.Frame(rawTab) ### LEFT VIEW ## # lefttext = """ TEXT DISPLAY """ self.rawleftscreen = self.initLeftTextView(rawLowerTab, lefttext, 20, 52) ### RUN-BUTTONS FRAME ## # buttonFrame = tk.Frame(rawLowerTab) ## BUTTTON ONE self.POS = POS_Retriever() self.NER = NER_Retriever() firstLabel = ttk.Label(buttonFrame, text=" ", font=("Helvitca", 12)) firstLabel.grid(row=0, column=0) btn_one_row = 1 btn_one_column = 0 Button_run(buttonFrame, 'LOAD TEXT', self.firstButton, btn_one_row, btn_one_column) ## BUTTTON TWO secondLabel = ttk.Label(buttonFrame, text=" ", font=("Helvitca", 12)) secondLabel.grid(row=2, column=0) btn_two_row = 3 btn_two_column = 0 Button_run(buttonFrame, 'SENTIMENT', self.secondButton, btn_two_row, btn_two_column) ## BUTTON THREE self.QueryAssistant = QueryAssistant() thirdLabel = ttk.Label(buttonFrame, text=" ", font=("Helvitca", 12)) thirdLabel.grid(row=4, column=0) btn_three_row = 5 btn_three_column = 0 Button_run(buttonFrame, 'SOMETHING', self.thirdButton, btn_three_row, btn_three_column) ## BUTTON FOUR fourthLabel = ttk.Label(buttonFrame, text=" ", font=("Helvitca", 12)) fourthLabel.grid(row=6, column=0) btn_fourth_row = 7 btn_fourth_column = 0 Button_run(buttonFrame, 'VISUALIZE', self.fourthButton, btn_fourth_row, btn_fourth_column) buttonFrame.grid(row=1, column=1) ### RAW RIGHT VIEW ## # self.rawrightscreen = self.initRightView(rawLowerTab) rawLowerTab['highlightthickness'] = 2 rawLowerTab['relief'] = 'groove' rawLowerTab.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) ############################### EVERYTHING BELOW IS IN TWEET TAB ################################## ### TWEET TOP FRAME ## # tweetTopTab = tk.Frame(tweetTab) tweetTopTab['highlightthickness'] = 2 tweetTopTab['relief'] = 'groove' tweetTopTab.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) tweetInfoLabel = ttk.Label(tweetTopTab, text="Get Tweets", font=("Helvitca", 16)) tweetInfoLabel.grid(row=0, column=0) ## TEXT INPUT keywordLabel = ttk.Label(tweetTopTab, text="Keyword:", font=("Helvitca", 12)) keywordLabel.grid(row=1, column=0) self.keywordEntry = tk.Entry(tweetTopTab) self.keywordEntry.grid(row=2, column=0) amountLabel = ttk.Label(tweetTopTab, text="Amount:", font=("Helvitca", 12)) amountLabel.grid(row=3, column=0) self.amountEntry = tk.Entry(tweetTopTab) self.amountEntry.grid(row=4, column=0) ## BUTTON & LABEL # GET TWEETS btn_getTweet_row = 5 btn_getTweet_column = 0 Button_tweet(tweetTopTab, 'COLLECT', self.getTweetButton, btn_getTweet_row, btn_getTweet_column) ## BUTTON & LABEL # STOP TWEET COLLECTION btn_killTweet_row = 6 btn_killTweet_column = 0 Button_tweet(tweetTopTab, 'STOP', self.killTweetButton, btn_killTweet_row, btn_killTweet_column) ## BUTTON & LABEL # DELETE TWEET COLLECTION btn_purgeTweet_row = 7 btn_purgeTweet_column = 0 Button_tweet(tweetTopTab, 'DELETE', self.purgeTweetButton, btn_purgeTweet_row, btn_purgeTweet_column) ## BOTTOM FRAME OF TWEET TAB # tweetLowerTab = tk.Frame(tweetTab) tweetLowerTab['highlightthickness'] = 2 tweetLowerTab['relief'] = 'groove' tweetLowerTab.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) ## TWEET LEFT TEXT VIEW # self.tweetleftscreen = self.initLeftTextView(tweetLowerTab, lefttext, 21, 53) ## TWEET RUN-BUTTONS FRAME # tweetButtonFrame = tk.Frame(tweetLowerTab) ##BUTTON ONE tweetFirstLabel = ttk.Label(tweetButtonFrame, text=" ", font=("Helvitca", 12)) tweetFirstLabel.grid(row=0, column=0) tweet_btn_one_row = 1 tweet_btn_one_column = 0 Button_run(tweetButtonFrame, 'LOAD TWEET', self.tweetFirstButton, tweet_btn_one_row, tweet_btn_one_column) ##BUTTON TWO tweetSecondLabel = ttk.Label(tweetButtonFrame, text=" ", font=("Helvitca", 12)) tweetSecondLabel.grid(row=2, column=0) tweet_btn_two_row = 3 tweet_btn_two_column = 0 Button_run(tweetButtonFrame, 'SENTIMENT', self.tweetSecondButton, tweet_btn_two_row, tweet_btn_two_column) ## BUTTON THREE tweetThirdLabel = ttk.Label(tweetButtonFrame, text=" ", font=("Helvitca", 12)) tweetThirdLabel.grid(row=4, column=0) tweet_btn_three_row = 5 tweet_btn_three_column = 0 Button_run(tweetButtonFrame, 'SOMETHING', self.tweetThirdButton, tweet_btn_three_row, tweet_btn_three_column) ##BUTTON FOUR tweetFourthLabel = ttk.Label(tweetButtonFrame, text=" ", font=("Helvitca", 12)) tweetFourthLabel.grid(row=6, column=0) tweet_btn_fourth_row = 7 tweet_btn_fourth_column = 0 Button_run(tweetButtonFrame, 'VISUALIZE', self.tweetFourthButton, tweet_btn_fourth_row, tweet_btn_fourth_column) tweetButtonFrame.grid(row=1, column=1) ### TWEET RIGHT VIEW ## # self.tweetrightscreen = self.initRightView(tweetLowerTab)
def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.ConnectHelper = ConnectHelper() self.TwitterHelper = TwitterHelper() self.parent = parent self['highlightthickness'] = 2 self.parent['highlightthickness'] = 2 self.parent['relief'] = 'groove' ### ALL NAVIGATION BAR RELATED BEEZZWAX ## # def hello(): print('Hello') MenuBar(parent, hello) ### HEADER FRAME ## CONTAINS: # headerFrame = tk.Frame(parent) headerFrame['highlightthickness'] = 2 headerFrame['relief'] = 'groove' totaltxt = ttk.Label(headerFrame, text="TEXT EXPLORER", font=("Times", 20)) totaltxt.pack() headerFrame.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) ### TABS AND MAIN CONTENT ## # mainFrame = tk.Frame(parent) mainFrame.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) tabController = ttk.Notebook(mainFrame) rawTab = ttk.Frame(tabController) tabController.add(rawTab, text="Raw Text Tab") tweetTab = ttk.Frame(tabController) tabController.add(tweetTab, text="Get Tweets Tab") FacebookTab = ttk.Frame(tabController) tabController.add(FacebookTab, text="Facebook Tab") tabController.pack(expand=1, fill='both', padx=5, pady=5) ############################### EVERYTHING BELOW IS IN RAW TEXT TAB ############################### ### TREEVIEW ## # rawTreeTab = tk.Frame(rawTab) path = "C:/Users/Y/Desktop/ny_styr/skeptics-texts/skeptics-texts" self.nodes = dict() frame = tk.Frame(rawTreeTab) self.tree = ttk.Treeview(frame, height=7) ttk.Style().configure("Treeview", background="#383838", foreground="#FFF") ysb = ttk.Scrollbar(frame, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(frame, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) self.tree.heading('#0', text="SELECT FILE", anchor='center') self.tree.pack(fill='x') frame.pack(fill='x') abspath = os.path.abspath(path) self.insert_node('', abspath, abspath) self.tree.bind('<<TreeviewOpen>>', self.open_node) self.tree.bind('<Double-1>', self.OnDoubleClick) rawTreeTab['highlightthickness'] = 2 rawTreeTab['relief'] = 'groove' rawTreeTab.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) rawLowerTab = tk.Frame(rawTab) ### LEFT VIEW ## # lefttext = """ LAST INN TEKSTER HER """ self.rawleftscreen = self.initLeftTextView(rawLowerTab, lefttext, 20, 52) ### RUN-BUTTONS FRAME ## # buttonFrame = tk.Frame(rawLowerTab) self.POS = POS_Retriever() firstLabel = ttk.Label(buttonFrame, text="Finn POS", font=("Helvitca", 12)) firstLabel.grid(row=0, column=0) def firstButton(): result = self.POS.find_POS(self.rawleftscreen.getContent()) print(result) self.loadRawTextRight(result) btn_one_row = 1 btn_one_column = 0 Button_run(buttonFrame, firstButton, btn_one_row, btn_one_column) self.NER = NER_Retriever() secondLabel = ttk.Label(buttonFrame, text="Finn NER", font=("Helvitca", 12)) secondLabel.grid(row=2, column=0) def secondButton(): content = self.rawleftscreen.getContent() result = self.NER.find_NER(content) self.loadRawTextRight(result) btn_two_row = 3 btn_two_column = 0 Button_run(buttonFrame, secondButton, btn_two_row, btn_two_column) thirdLabel = ttk.Label(buttonFrame, text="Finn Sentiment", font=("Helvitca", 12)) thirdLabel.grid(row=4, column=0) def thirdButton(): content = self.rawleftscreen.getContent() print(content) self.ConnectHelper.send_get_query() print('--' * 15) self.ConnectHelper.send_ask_query() print('--' * 15) self.ConnectHelper.send_desc_query() btn_three_row = 5 btn_three_column = 0 Button_run(buttonFrame, thirdButton, btn_three_row, btn_three_column) self.QueryAssistant = QueryAssistant() fourthLabel = ttk.Label(buttonFrame, text="Query", font=("Helvitca", 12)) fourthLabel.grid(row=6, column=0) def fourthButton(): content = self.rawleftscreen.getContent() print(content) primary_subj, other_subj = self.QueryAssistant.test(content) for thing in primary_subj: print("[+]---------- QUERY SESS STARTED ---------[+]") self.ConnectHelper.send_get_query(thing) print('--' * 15) self.ConnectHelper.send_ask_query(thing) print('--' * 15) self.ConnectHelper.send_desc_query(thing) btn_fourth_row = 7 btn_fourth_column = 0 Button_run(buttonFrame, fourthButton, btn_fourth_row, btn_fourth_column) buttonFrame.grid(row=1, column=1) ### RIGHT VIEW ## # righttext = """ OUTPUT VISES HER """ self.rawrightscreen = self.initRightTextView(rawLowerTab, righttext, 20, 52) rawLowerTab['highlightthickness'] = 2 rawLowerTab['relief'] = 'groove' rawLowerTab.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) ############################### EVERYTHING BELOW IS IN TWEET TAB ################################## ### TWEET TOP FRAME ## # tweetTopTab = tk.Frame(tweetTab) tweetTopTab['highlightthickness'] = 2 tweetTopTab['relief'] = 'groove' tweetTopTab.grid(row=0, column=0, columnspan=3, sticky=tk.NSEW) tweetInfoLabel = ttk.Label(tweetTopTab, text="Get Tweets", font=("Helvitca", 16)) tweetInfoLabel.grid(row=0, column=0) keywordLabel = ttk.Label(tweetTopTab, text="Keyword:", font=("Helvitca", 12)) keywordLabel.grid(row=1, column=0) keywordEntry = tk.Entry(tweetTopTab) keywordEntry.grid(row=2, column=0) amountLabel = ttk.Label(tweetTopTab, text="Amount:", font=("Helvitca", 12)) amountLabel.grid(row=3, column=0) amountEntry = tk.Entry(tweetTopTab) amountEntry.grid(row=4, column=0) def getTweetButton(): print('[+] Get tweet button working...') print('-----' * 20) a = keywordEntry.get() self.TwitterHelper.get_tweet(a) btn_getTweet_row = 5 btn_getTweet_column = 0 Button_tweet(tweetTopTab, getTweetButton, btn_getTweet_row, btn_getTweet_column) tweetLowerTab = tk.Frame(tweetTab) tweetLowerTab['highlightthickness'] = 2 tweetLowerTab['relief'] = 'groove' tweetLowerTab.grid(row=1, column=0, columnspan=3, sticky=tk.NSEW) ### TWEET LEFT TEXT VIEW ## # self.tweetleftscreen = self.initLeftTextView(tweetLowerTab, lefttext, 21, 50) ### TWEET RUN-BUTTONS FRAME ## # tweetButtonFrame = tk.Frame(tweetLowerTab) self.POS = POS_Retriever() tweetFirstLabel = ttk.Label(tweetButtonFrame, text="Finn POS", font=("Helvitca", 12)) tweetFirstLabel.grid(row=0, column=0) def tweetFirstButton(): content = self.tweetleftscreen.getContent() result = self.POS.find_POS(content) print(result) self.loadTweetTextRight(result) tweet_btn_one_row = 1 tweet_btn_one_column = 0 Button_run(tweetButtonFrame, tweetFirstButton, tweet_btn_one_row, tweet_btn_one_column) self.NER = NER_Retriever() tweetSecondLabel = ttk.Label(tweetButtonFrame, text="Finn NER", font=("Helvitca", 12)) tweetSecondLabel.grid(row=2, column=0) def tweetSecondButton(): content = self.tweetleftscreen.getContent() result = self.NER.find_NER(content) self.loadTweetTextRight(result) tweet_btn_two_row = 3 tweet_btn_two_column = 0 Button_run(tweetButtonFrame, tweetSecondButton, tweet_btn_two_row, tweet_btn_two_column) tweetThirdLabel = ttk.Label(tweetButtonFrame, text="Finn sentiment", font=("Helvitca", 12)) tweetThirdLabel.grid(row=4, column=0) def tweetThirdButton(): content = self.tweetleftscreen.getContent() print(content) tweet_btn_three_row = 5 tweet_btn_three_column = 0 Button_run(tweetButtonFrame, tweetThirdButton, tweet_btn_three_row, tweet_btn_three_column) tweetFourthLabel = ttk.Label(tweetButtonFrame, text="Query", font=("Helvitca", 12)) tweetFourthLabel.grid(row=6, column=0) def tweetFourthButton(): content = self.tweetleftscreen.getContent() print(content) tweet_btn_fourth_row = 7 tweet_btn_fourth_column = 0 Button_run(tweetButtonFrame, tweetFourthButton, tweet_btn_fourth_row, tweet_btn_fourth_column) tweetButtonFrame.grid(row=1, column=1) ### TWEET RIGHT VIEW ## # self.tweetrightscreen = self.initRightView(tweetLowerTab)