def Open(self): """打开视频原文件按钮响应函数""" self.fileName, self.fileType = QFileDialog.getOpenFileName( self.mainWnd, 'Choose file', '', '*.avi') if self.fileName is None or '.avi' not in self.fileName: return elif 'out' not in self.fileName: VedioDate = time.ctime(os.path.getctime(self.fileName)) VedioDate = VedioDate.replace(' ', "_").replace(':', '_').replace('__', '_') PATH.setValue('CVedioDate', VedioDate) self.ui.label_date_text.setText(PATH.get_VedioDate()) self.video_outname = PATH.run_a_red_light_vedio_path() #刷新信息显示 self.ui.label_roadinfo.setText(" 车流量信息展示区域") self.model = QStandardItemModel() #存储任意结构数据 self.model.setHorizontalHeaderLabels(['车牌号码', '违章类型']) self.ui.tableView.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.ui.tableView.setModel(self.model) # 创建视频显示线程 self.Vedioplayname = self.fileName th = threading.Thread(target=self.Display) th.start()
def get_roadinfo(self): """确定路口和时间段之后的操作""" if self.ui.chooseRoad.currentIndex() == -1: dig = QMessageBox.information(self, "提示", "未选择路口", QMessageBox.Yes) return self.ChosedTime = self.ui.choose_time.currentText() self.mainWnd.ui.label_road_text.setText(self.ChosedRoad) if self.ChosedTime == "所有时间" and self.ChosedRoad != "所有路口": PATH.setValue('RoadName', self.ChosedRoad) PATH.setValue('CVedioDate', self.ChosedTime) PATH.bool_alltimes = True else: PATH.bool_alltimes = False try: PATH.setValue('RoadName', self.ChosedRoad) PATH.setValue('CVedioDate', self.ChosedTime) Vedio_OutFileName = PATH.detect_result_path + self.ChosedRoad + '\\' + self.ChosedTime + "\\" + "Vedio_out.avi" self.mainWnd.Vedioplayname = Vedio_OutFileName self.mainWnd.specialroad = True self.show_processed_info.emit() except: dig = QMessageBox.warning(self, "警告", "未找到目标视频文件", QMessageBox.Yes) self.mainWnd.ui.label_date_text.setText(self.ChosedTime) self.mainWnd.ui.Open.setEnabled(True) self.mainWnd.ui.Button_imgout.setEnabled(True) self.mainWnd.ui.Button_infoout.setEnabled(True)
def Open(self): """打开视频原文件按钮响应函数""" self.fileName, self.fileType = QFileDialog.getOpenFileName( self.mainWnd, 'Choose file', '', '*.avi') if self.fileName is None or '.avi' not in self.fileName: return elif 'out' not in self.fileName: VedioDate = time.ctime(os.path.getctime(self.fileName)) VedioDate = VedioDate.replace(' ', "_").replace(':', '_').replace('__', '_') PATH.setValue('CVedioDate', VedioDate) self.ui.label_date_text.setText(PATH.get_VedioDate()) self.video_outname = PATH.run_a_red_light_vedio_path() # 创建视频显示线程 self.Vedioplayname = self.fileName th = threading.Thread(target=self.Display) th.start()
def set_road(self): """路口设置对话框响应函数""" self.mainWnd.ui.Open.setEnabled(True) self.mainWnd.ui.Button_imgout.setEnabled(True) self.mainWnd.ui.Button_infoout.setEnabled(True) if self.ui.Text_NewRoad.toPlainText( ) is '' and self.ui.Box_Existed_Roads.currentIndex() is not -1: PATH.setValue('RoadName', self.ui.Box_Existed_Roads.currentText()) self.mainWnd.ui.label_road_text.setText( self.ui.Box_Existed_Roads.currentText()) elif self.ui.Text_NewRoad.toPlainText() is not '': PATH.setValue('RoadName', self.ui.Text_NewRoad.toPlainText()) self.mainWnd.ui.label_road_text.setText( self.ui.Text_NewRoad.toPlainText()) else: dig = QMessageBox.warning(self, "警告", "当前未设置路口!", QMessageBox.Yes) return dig = QMessageBox.information(self, "提示", "路口设置成功", QMessageBox.Yes) self.mainWnd.ui.Open.setEnabled(True) self.mainWnd.ui.Button_imgout.setEnabled(True) self.mainWnd.ui.Button_infoout.setEnabled(True)