def download_data(self, draw_graph=True): """ Download data callback. Gets data from API/Db :type draw_graph: Bool """ if self.mode == self.MODE_STATION: sensors = self.selected_sensors[self.current_station] try: data = self.data_manager.get_data_by_sensor_ids_for_graphing( sensors) if draw_graph: station_name = self.data_manager.get_station_name_by_id( self.current_station) GraphDrawer.draw_station_graph(station_name, data) except DataManagerError as e: self.logger.exception(e) self.show_exception_box(e) else: stations = self.selected_stations[self.current_param] try: data = self.data_manager.get_data_by_station_ids_for_graphing( stations, self.current_param) except DataManagerError as e: self.logger.exception(e) self.show_exception_box(e) if draw_graph: GraphDrawer.draw_sensor_graph(self.current_param, data)
def initUI(self): self.setWindowTitle('Graph visualization') self.resize(1200, 600) self.toCenter() name_label = QLabel("Enter name:", self) name_label.resize(name_label.sizeHint()) self.nameEdit = QLineEdit("Name", self) self.nameEdit.setObjectName("file") self.nameEdit.resize(self.nameEdit.sizeHint()) self.nameEdit.setToolTip('Select file') self.error_label = QLabel("", self) self.error_label.resize(name_label.sizeHint()) self.error_label.hide() enter_game_button = QPushButton('Enter', self) enter_game_button.resize(enter_game_button.sizeHint()) home_button = QPushButton('Home', self) home_button.resize(home_button.sizeHint()) weight_visibler_button = QPushButton('Show/Hide weight', self) weight_visibler_button.resize(weight_visibler_button.sizeHint()) load_status_layout = QVBoxLayout() load_status_layout.setSpacing(0) load_status_layout.addWidget(self.nameEdit) load_status_layout.addWidget(self.error_label) tools_grid = QGridLayout() tools_grid.setHorizontalSpacing(10) tools_grid.setVerticalSpacing(5) tools_grid.addWidget(name_label, 1, 0) tools_grid.addLayout(load_status_layout, 1, 1) tools_grid.addWidget(enter_game_button, 1, 2) tools_grid.addWidget(home_button, 2, 0) tools_grid.addWidget(weight_visibler_button, 2, 2) graph_drawer = GraphDrawer() graph_drawer.resize(500, 800) self.graphWidget = graph_drawer verticalLayout = QSplitter() verticalLayout.addWidget(self.graphWidget) verticalLayout.addWidget(LegendDrawer(self)) verticalLayout.SetMinimumSize = (800, 670) tools_grid.addWidget(verticalLayout, 3, 0, 3, 3) tools_grid.SetMinimumSize = (900, 680) self.setLayout(tools_grid) home_button.clicked.connect(self.graphWidget.cameraToHome) enter_game_button.clicked.connect(self.enterTheGame) weight_visibler_button.clicked.connect(self.changeWeightVisibility) self.show()
from graph_drawer import GraphDrawer # usage example a = GraphDrawer() a.loadEdgeList([('Da Nang', 'Sai Gon', 5),('Da Nang', 'Hue', 2),('Can Tho', 'Hue', 6),('Long An', 'Sai Gon', 1),('Ha Noi', 'Hue', 12)]) a.chooseIntitial('Long An') a.choosePath([('Long An', 'Sai Gon'),('Sai Gon', 'Da Nang')]) a.plot()
word_analyze = WordAnalyze() capture = cv2.VideoCapture(0) face_recognizer = FaceRecognizer(capture=capture) speech_recognizer = SpeechRecognizer() speech_recognizer.start() w=int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH )) h=int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT )) fourcc = cv2.cv.CV_FOURCC('m', 'p', '4', 'v') graph_drawer = GraphDrawer() graph_drawer.start() all_omorosa = OmoroiData() all_graph = Graph(color=(1.0,0.0,1.0),ylim=[all_omorosa.omoroi_min-1.0,all_omorosa.omoroi_max+1.0],ylabel="Omorosa") #if os.path.exists('movie.avi'): # os.remove('movie.avi') #out = cv2.VideoWriter('movie.avi',fourcc,7.5,(w,h)) count = 0 while(True): # 動画ストリームからフレームを取得 speech = speech_recognizer.get_speech()