def __init__(self): # Initalize parent QMainWindow.__init__(self) # Initalize GUI layout self.setWindowIcon(QtGui.QIcon('myIcon.png')) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.eds_data = None self.comps = None self.technique = "WDS" self.read_counts = False self.ib = None self.N = 0 # N is the row_number # # pre-selection before import files # self.ui.elements.clicked.connect(lambda: self.elements) # self.ui.technique.clicked.connect(lambda: self.technique) # self.ui.read_counts.clicked.connect(lambda: self.read_counts) # self.ui.image_plot.clicked.connect(lambda: self.plotting('image')) # self.set_combo_Elements(self.comps) # self.set_combo_DataElements(self.comps) self.set_default_elements() self.ui.image_plot.clicked.connect(lambda: self.image_plots()) self.ui.line_plot.clicked.connect(lambda: self.line_plots()) self.ui.datashow.clicked.connect(lambda: self.show_data()) self.ui.actionImport_folder.triggered.connect(lambda: self.import_message()) self.ui.actionImport_folder.triggered.connect(lambda: self.import_data("folder")) self.ui.actionImport_file.triggered.connect(lambda: self.import_message()) self.ui.actionImport_file.triggered.connect(lambda: self.import_data("file")) self.ui.actionExport.triggered.connect(lambda: self.export_data()) self.ui.actionAbout.triggered.connect(self.about)
def __init__(self, parent=None): super(Quickstart, self).__init__(parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.started = False self.start_time = 0 self.end_time = 0
def __init__(self, parent=None): super(MainUi, self).__init__(parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) page = WebPage() self.ui.webView.setPage(page) self.loadHTMLTemplate() self.timer = QtCore.QTimer() self.ui.btnGenRoute.clicked.connect(self.callGetShape) self.ui.btnClearPaths.clicked.connect(self.clearPaths) self.ui.btnHexToggleMaps.clicked.connect(self.toggleMapsJS) self.ui.spinAngle.valueChanged.connect(self.paramsChanged) self.ui.spinWidthSize.valueChanged.connect(self.paramsChanged) self.connect(self.ui.actionSave_polygon_shape, SIGNAL("triggered()"), self.savePolyShapeToFile) self.connect(self.ui.actionLoad_polygon_shape, SIGNAL("triggered()"), self.loadPolyShapeFromFile) self.connect(self.ui.actionExit_program, SIGNAL("triggered()"), self.close) self.connect(self.ui.actionReload_Map, SIGNAL("triggered()"), self.loadHTMLTemplate) self.connect(self.ui.actionExport_Route, SIGNAL("triggered()"), self.exportGPSroute) self.path_gps_json = None self.path_hex_gps_json = None self.roi_gps_json = None
def __init__(self): """ Initialize the controller """ super().__init__() self.view = Ui_MainWindow() # Instantiate the view class self.view.setupUi(self) # Set up the UI # Connect signals and slots # Reset button clears all input fields and the output self.view.reset_button.clicked.connect(self.view.value_input.clear) self.view.reset_button.clicked.connect( self.view.from_currency_input.clear) self.view.reset_button.clicked.connect( self.view.to_currency_input.clear) self.view.reset_button.clicked.connect(self.view.result_display.clear) self.view.exit_button.clicked.connect( self.close ) # Exit button closes the window (and quits the application) self.view.live_data.stateChanged['int'].connect( self.use_live_data) # state_changed checkbox switches modes self.view.convert_button.clicked.connect( self.convert ) # Convert button calls convert() method of controller # Instantiate the model using an instance of LiveDataConverter (for using online exchange rates) self.model = model.MainModel(model.LiveDataConverter())
def __init__(self, parent=None): self.position = 38 self.gen = Generator() QtWidgets.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.initUI() self.setFixedSize(self.size())
def __init__(self): super(window, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.encoder = None self.digitalCryptographySystem = None self.ui.pushButton.clicked.connect(lambda: self.polybius_code()) self.ui.pushButton_2.clicked.connect(lambda: self.polybius_decode()) self.ui.pushButton_3.clicked.connect(lambda: self.digitalCryptographySystem_code()) self.ui.pushButton_4.clicked.connect(lambda: self.digitalCryptographySystem_decode())
def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() self.ui.filename_lbl.setText("Music Player") self.ui.actionOpen.triggered.connect(self.open_file) self.ui.actionExit.triggered.connect(self.exit_player) self.ui.play_btn.clicked.connect(self.play_music) self.loaded_file = False self.location = ''
def __init__(self): super(Ui, self).__init__() # Call the inherited classes __init__ method self.ui = Ui_MainWindow() self.ui.setupUi(self) self.setStyleSheet("QMainWindow {background: '#f0f0f0';}") self.statusBar = QtWidgets.QStatusBar() self.setStatusBar(self.statusBar) self.pushButton = self.ui.pushButton self.com_in = self.ui.com_in self.com_out = self.ui.com_out self.baud_in = self.ui.baud_in self.baud_out = self.ui.baud_out self.pitch_correction = self.ui.pitch_correction self.roll_correction = self.ui.roll_correction self.console_out = self.ui.console_out self.console_in = self.ui.console_in self.menubar = self.ui.menubar self.pushButton.clicked.connect(self.start) self.flag = True self.setWindowTitle('LGC TILT') self.pushButton.setStyleSheet( 'QPushButton {background-color: #E7F1E1; border: none}') com_list = [] for i in serial.tools.list_ports.comports(): com_list.append(str(i).split(" ")[0]) sorted_list = [] for i in range(300): this_com = ("COM" + str(i)) if this_com in com_list: sorted_list.append(this_com) self.com_in.addItems(sorted_list) self.com_out.addItems(sorted_list) self.threadpool = QtCore.QThreadPool() self.serial_object = None self.settings = QtCore.QSettings(self.objectName()) self.com_in.setCurrentIndex(self.settings.value('com_in', 0)) self.com_out.setCurrentIndex(self.settings.value('com_out', 1)) self.baud_in.setCurrentIndex(self.settings.value('baud_in', 2)) self.baud_out.setCurrentIndex(self.settings.value('baud_out', 2)) self.pitch_correction.setText( self.settings.value('pitch_correction', '0')) self.roll_correction.setText( self.settings.value('roll_correction', '0')) self.restoreGeometry(self.settings.value('geo', self.saveGeometry())) self.settings.setValue('com_in', self.com_in.currentIndex()) self.worker = None self.menubar.setHidden(True) self.show() # Show the GUI
def __init__(self): super().__init__() self.setting = {} self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dir = '../../captcha' self.png_dict = self.load_csv() for name in self.list_png(): if not name in self.png_dict: self.png_dict[name] = "" self.png_list = list(self.png_dict.keys()) self.png_list.sort() self.idx = 0 self.update_img() self.ui.lableLineEdit.installEventFilter(self)
def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) # ==================== # == output browser == # ==================== linePlainTextEdit = LinePlainTextEdit(self) outputTextBrowser = self.ui.outputTextBrowser self.ui.verticalLayout.replaceWidget(outputTextBrowser, linePlainTextEdit) self.ui.outputTextBrowser = linePlainTextEdit self.ui.outputTextBrowser.setReadOnly(True) outputTextBrowser.deleteLater() self.ui.outputTextBrowser.setLineWrapMode(QPlainTextEdit.NoWrap) scrollBar = self.ui.outputTextBrowser.verticalScrollBar() scrollBar.setStyleSheet("background-color: rgb(240, 240, 240);\n""color: rgb(12, 12, 12);") scrollBar = self.ui.outputTextBrowser.horizontalScrollBar() scrollBar.setStyleSheet("background-color: rgb(240, 240, 240);\n""color: rgb(12, 12, 12);") self.ui.outputTextBrowser.setStyleSheet("background-color: rgb(30, 30, 30);\n""color: rgb(236, 236, 236);") self.ui.outputTextBrowser.installEventFilter(self) font = QFont() font.setFamily("Consolas") font.setPointSize(14) self.ui.outputTextBrowser.setFont(font) # ============================= self.ser = serial_port.QPySerial() self.ser.errorOccurred.connect(self.on_serial_errorOccurred) self.load_setting() self.timer = QTimer(self) self.timer.timeout.connect(self.read_from_ser) self.setWindowIcon(QIcon(r':icon.ico')) self.setWindowTitle('ATerm '+__version__) buads = [9600, 115200] + self.setting['custom_baud'] buads = [str(b) for b in sorted(list(set(buads)))] self.ui.baudComboBox.addItems(buads) self.ui.baudComboBox.setLineEdit(QLineEdit()) self.on_refreshBtn_clicked()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.filenames = ['', '', ''] self.graphChannels = [ self.ui.signal1Graph, self.ui.signal2Graph, self.ui.signal3Graph ] self.spectrogramChannels = [ self.ui.spectrogram1Graph, self.ui.spectrogram2Graph, self.ui.spectrogram3Graph ] self.timers = [self.ui.timer1, self.ui.timer2, self.ui.timer3] self.pen = [ pg.mkPen(color=(255, 0, 0), width=1), pg.mkPen(color=(0, 255, 0), width=1), pg.mkPen(color=(0, 0, 255), width=1) ] self.PLOT_DIR = 'Plots' self.PDF_DIR = 'PDFs' self.amplitude = [[], [], []] self.time = [[], [], []] self.upToDatePlots = [[], [], []] self.spectrogramData = [None, None, None] self.pointsToAppend = [0, 0, 0] self.isResumed = [False, False, False] self.setChannelChecked = [ self.ui.showChannel1, self.ui.showChannel2, self.ui.showChannel3 ] self.channelComponents = [ self.ui.channel1, self.ui.channel2, self.ui.channel3 ] self.CHANNEL1 = 0 self.CHANNEL2 = 1 self.CHANNEL3 = 2 self.ui.showChannel1.setChecked(True) self.ui.showChannel2.setChecked(True) self.ui.showChannel3.setChecked(True) self.ui.channel1.show() self.ui.channel2.show() self.ui.channel3.show() self.ui.showChannel1.stateChanged.connect( lambda: self.toggle(self.CHANNEL1)) self.ui.showChannel2.stateChanged.connect( lambda: self.toggle(self.CHANNEL2)) self.ui.showChannel3.stateChanged.connect( lambda: self.toggle(self.CHANNEL3)) self.ui.actionAbout.triggered.connect(lambda: self.showAbout()) self.ui.actionExit.triggered.connect(lambda: self.close()) self.ui.actionNew.triggered.connect(lambda: self.create_new_window()) self.ui.actionOpenChannel1.triggered.connect( lambda: self.browse(self.CHANNEL1)) self.ui.playBtn1.clicked.connect(lambda: self.play(self.CHANNEL1)) self.ui.pauseBtn1.clicked.connect(lambda: self.pause(self.CHANNEL1)) self.ui.focusBtn1.clicked.connect(lambda: self.graphChannels[ self.CHANNEL1].getPlotItem().enableAutoRange()) self.ui.zoomInBtn1.clicked.connect(lambda: self.zoomin(self.CHANNEL1)) self.ui.zoomOutBtn1.clicked.connect( lambda: self.zoomout(self.CHANNEL1)) self.ui.clearBtn1.clicked.connect(lambda: self.clear(self.CHANNEL1)) self.ui.actionOpenChannel2.triggered.connect( lambda: self.browse(self.CHANNEL2)) self.ui.playBtn2.clicked.connect(lambda: self.play(self.CHANNEL2)) self.ui.pauseBtn2.clicked.connect(lambda: self.pause(self.CHANNEL2)) self.ui.focusBtn2.clicked.connect(lambda: self.graphChannels[ self.CHANNEL2].getPlotItem().enableAutoRange()) self.ui.zoomInBtn2.clicked.connect(lambda: self.zoomin(self.CHANNEL2)) self.ui.zoomOutBtn2.clicked.connect( lambda: self.zoomout(self.CHANNEL2)) self.ui.clearBtn2.clicked.connect(lambda: self.clear(self.CHANNEL2)) self.ui.actionOpenChannel3.triggered.connect( lambda: self.browse(self.CHANNEL3)) self.ui.playBtn3.clicked.connect(lambda: self.play(self.CHANNEL3)) self.ui.pauseBtn3.clicked.connect(lambda: self.pause(self.CHANNEL3)) self.ui.focusBtn3.clicked.connect(lambda: self.graphChannels[ self.CHANNEL3].getPlotItem().enableAutoRange()) self.ui.zoomInBtn3.clicked.connect(lambda: self.zoomin(self.CHANNEL3)) self.ui.zoomOutBtn3.clicked.connect( lambda: self.zoomout(self.CHANNEL3)) self.ui.clearBtn3.clicked.connect(lambda: self.clear(self.CHANNEL3)) self.ui.generatePDF.clicked.connect(lambda: self.generatePDF()) self.show()
def __init__(self): super(MyUi, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) cwd = os.getcwd() cwd = str(cwd) if os.path.isfile(cwd + "/time"): with open("time", "r") as outfile: #reads current time history = cPickle.load(outfile) if (datetime.now() - history ).total_seconds() < 43200: #measures if time elapse>12 hours print("Less than 12 hours. Loading previously saved Pickle...") #with open("time","w") as infile: #update time #cPickle.dump(datetime.now(),infile) # else: print("More than 12 hours. Updating Pickle...") data = ts.get_industry_classified() with open("class", "w+") as outfile: cPickle.dump(data, outfile) now = datetime.now() with open("time", "w+") as outfile: #update time cPickle.dump(now, outfile) else: print("No Pickle found!" ) #If this is first time using tuchart in this directory data = df() data = ts.get_industry_classified() with open('class', 'w+') as outfile: #records pickle cPickle.dump(data, outfile) now = datetime.now() with open("time", "w+") as outfile: cPickle.dump(now, outfile) with open("class", "r") as infile: # reads current time series = cPickle.load(infile) #series = pd.read_json(cwd + "\\class.json") #series = ts.get_industry_classified() series = pd.DataFrame(series) curdate = time.strftime( "%Y/%m/%d") # gets current time to put into dateedit curdateQ = QDate.fromString(curdate, "yyyy/MM/dd") dateobj = datetime.strptime(curdate, "%Y/%m/%d") #converts to datetime object past = dateobj - timedelta(days=7) #minus a week to start date pasttime = datetime.strftime(past, "%Y/%m/%d") pastQ = QDate.fromString( pasttime, "yyyy/MM/dd") #convert to qtime so that widget accepts the values pastL = dateobj - timedelta(days=30) # minus a month to start date pasttimeL = datetime.strftime(pastL, "%Y/%m/%d") pastQL = QDate.fromString(pasttimeL, "yyyy/MM/dd") np_indexes = np.array([['sh', '上证指数', '大盘指数'], ['sz', '深证成指', '大盘指数'], ['hs300', '沪深300指数', '大盘指数'], ['sz50', '上证50', '大盘指数'], ['zxb', '中小板', '大盘指数'], ['cyb', '创业板', '大盘指数']]) indexes = df(data=np_indexes, index=range(5000, 5006), columns=["code", "name", "c_name"]) series = indexes.append(series) list1_bfr = series["c_name"].tolist( ) #Get industry categories. Filters out redundant ones list1 = list(set(list1_bfr)) list1.sort(key=list1_bfr.index) #w = database() #zsparent = QTreeWidgetItem(self.ui.treeWidget) #zsparent.setText(0,"股票指数") #zsnames =["上证指数-sh","深圳成指-sz","沪深300指数-hs300","上证50-"] self.init_treeWidget(list1, series) self.ui.treeWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeWidget.customContextMenuRequested.connect(self.openMenu) #self.ui.webView.setGeometry(QtCore.QRect(0, 30,1550, 861)) file_path = os.path.abspath( os.path.join(os.path.dirname(__file__), "render.html")) #path to read html file local_url = QUrl.fromLocalFile(file_path) self.ui.webView.load(local_url) #self.ui.commandLinkButton.setFixedSize(50, 50) self.ui.search_btn.clicked.connect(lambda: self.search_comp(series)) self.ui.log_btn.clicked.connect(lambda: self.log()) self.ui.init_code_btn.clicked.connect( lambda: self.code_sort_tree(series)) self.ui.init_category_btn.clicked.connect( lambda: self.init_treeWidget(list1, series)) self.ui.commandLinkButton.clicked.connect( self.classify) #when the arrow button is clicked, trigger events #self.ui.commandLinkButton.clicked.connect(lambda action: self.classify(action, self.ui.treewidget)) # QSizePolicy try: retain_size = self.ui.dateEdit_2.sizePolicy() retain_size.setRetainSizeWhenHidden(True) self.ui.dateEdit_2.setSizePolicy(retain_size) retain_size = self.ui.comboBox.sizePolicy() retain_size.setRetainSizeWhenHidden(True) # self.ui.comboBox.setSizePolicy(retain_size) retain_size = self.ui.label_2.sizePolicy() retain_size.setRetainSizeWhenHidden(True) self.ui.label_2.setSizePolicy(retain_size) except AttributeError: print("No PYQT5 Binding! Widgets might be deformed") self.ui.dateEdit.setDate(pastQL) self.ui.dateEdit_2.setDate(curdateQ) #populate widgets self.ui.dateEdit.setCalendarPopup(True) self.ui.dateEdit_2.setCalendarPopup(True) self.ui.comboBox.addItems(["D"]) self.ui.treeWidget_2.setDragDropMode(self.ui.treeWidget_2.InternalMove) self.ui.treeWidget_2.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeWidget_2.customContextMenuRequested.connect( self.openWidgetMenu) #self.ui.toolbutton.clicked.connect(lambda action: self.graphmerge(action, CombineKeyword)) self.ui.combobox.currentIndexChanged.connect( lambda: self.modifycombo(pastQL, pastQ))
def __init__(self): super().__init__() self.components = Ui_MainWindow() self.components.setupUi(self) self.show() self.components.start_button.clicked.connect( lambda: print(self.components.path_input.text())) # TODO file selector self.components.use_id_button.toggled.connect(lambda: print( 'status: ' + str(self.components.use_id_button.isChecked()))) # TODO editable elements # TODO group disable def temp(): dl = QtWidgets.QFileDialog() dl.setAcceptMode(QtWidgets.QFileDialog.AcceptSave) dl.setNameFilter('Excel File (*.xlsx)') if dl.exec_(): filenames = dl.selectedFiles() print(filenames) self.components.open_button.clicked.connect(temp) self.disable_group = [ self.components.sheet_name_input, self.components.pub_title_input, self.components.lib_title_input, self.components.letter_only_button, self.components.no_space_button, self.components.strict_button, self.components.correct_color_box, self.components.ambiguous_color_box, self.components.wrong_color_box ] self.id_group = [ self.components.pub_id_input, self.components.lib_id_input ] self.color_group = [ self.components.correct_color_box, self.components.ambiguous_color_box, self.components.wrong_color_box ] COLOR_ITEM = [ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen' ] for color_box in self.color_group: color_box.addItems(COLOR_ITEM) self.components.correct_color_box.setCurrentIndex( self.components.correct_color_box.findText('green')) self.components.ambiguous_color_box.setCurrentIndex( self.components.ambiguous_color_box.findText('yellow')) self.components.wrong_color_box.setCurrentIndex( self.components.wrong_color_box.findText('red')) def change_disable_status(): dis_flag = self.components.use_user_enter_button.isChecked() id_flag = self.components.use_id_button.isChecked() for element in self.disable_group: element.setDisabled(not dis_flag) for element in self.id_group: element.setDisabled(not (id_flag and dis_flag)) def change_id_status(): dis_flag = self.components.use_user_enter_button.isChecked() id_flag = self.components.use_id_button.isChecked() for element in self.id_group: element.setDisabled(not (id_flag and dis_flag)) change_disable_status() self.components.use_user_enter_button.clicked.connect( change_disable_status) self.components.use_id_button.clicked.connect(change_id_status) # TODO if user use self defined data, give a warninig def start_helper(): file_path = self.components.path_input.text()
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) _dir = os.path.dirname(os.path.abspath(__file__)) #uic.loadUi(_dir + '/' + 'layout.ui', self) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.profileWidget.hide() self.ui.smallDataWidget.hide() self.ui.splitter_3.setSizes([ self.width() * 0.7, self.width() * 0.3 ]) # splitter between image_view/plot_widget and file list self.ui.splitter_2.setSizes([ self.height() * 0.7, self.height() * 0.3 ]) # splitter between image_view and plot widget self.ui.splitter.setSizes([ self.ui.splitter.width() / 3., self.ui.splitter.width() / 3., self.ui.splitter.width() / 3. ]) self.setAcceptDrops(True) self.ui.fileList.setColumnWidth(0, 200) self.filepath = None # current filepath self.imageData = None # original image data, 2d or 3d self.imageShape = None self.dispData = None # 2d data for plot self.dispShape = None self.mask = None self.curve = None self.h5obj = None self.acceptedFileTypes = [ u'npy', u'npz', u'h5', u'mat', u'cxi', u'tif' ] self.dispItem = self.ui.imageView.getImageItem() self.ringItem = pg.ScatterPlotItem() self.centerMarkItem = pg.ScatterPlotItem() self.ui.imageView.getView().addItem(self.ringItem) self.ui.imageView.getView().addItem(self.centerMarkItem) self.curveItem = PlotDataItem() self.ui.curveWidget.addItem(self.curveItem) self.ui.curveWidget.getPlotItem().setTitle(title='Curve Plot') # basic operation for image and curve plot self.showImage = True self.axis = 'x' self.frameIndex = 0 self.maskFlag = False self.imageLog = False self.binaryFlag = False self.FFT = False self.FFTSHIFT = False self.dispThreshold = 0 self.center = [0, 0] self.showRings = False self.ringRadiis = [] self.showCurvePlot = True self.profileItem = PlotDataItem(pen=pg.mkPen( 'y', width=1, style=QtCore.Qt.SolidLine), name='profile') self.smoothItem = PlotDataItem(pen=pg.mkPen('g', width=2, style=QtCore.Qt.DotLine), name='smoothed profile') self.thresholdItem = PlotDataItem(pen=pg.mkPen('r'), width=1, style=QtCore.Qt.DashLine, name='threshold') self.ui.profileWidget.addLegend() self.ui.profileWidget.addItem(self.profileItem) self.ui.profileWidget.addItem(self.smoothItem) self.ui.profileWidget.addItem(self.thresholdItem) self.ui.profileWidget.getPlotItem().setTitle(title='Profile Plot') # profile option self.showProfile = False self.profileType = 'radial' self.profileMode = 'sum' # extrema search self.extremaSearch = False self.extremaType = 'max' self.extremaWinSize = 11 self.extremaThreshold = 1.0 # ratio compared to mean value # angular option self.angularRmin = 0. self.angularRmax = np.inf # across center line option self.lineAngle = 0. self.lineWidth = 1 # profile smoothing self.smoothFlag = False self.smoothWinSize = 15 self.polyOrder = 3 # small data option self.smallDataItem = pg.ScatterPlotItem() self.ui.smallDataWidget.addItem(self.smallDataItem) self.ui.smallDataWidget.getPlotItem().setTitle(title='Small Data') self.showSmallData = False self.smallDataFile = None self.smallDataset = None self.smallDataSorted = False self.smallDataPaths = None self.smallDataFrames = None self.smallData = None # display option self.imageAutoRange = False self.imageAutoLevels = False self.imageAutoHistogramRange = True self.curvePlotAutoRange = True self.curvePlotLog = False self.profilePlotAutoRange = True self.profilePlotLog = False self.smallDataPlotAutoRange = True self.smallDataPlotLog = False params_list = [{ 'name': 'Data Info', 'type': 'group', 'children': [{ 'name': 'File', 'type': 'str', 'value': 'not set', 'readonly': True }, { 'name': 'Dataset', 'type': 'str', 'value': 'not set', 'readonly': True }, { 'name': 'Mask', 'type': 'str', 'value': 'not set', 'readonly': True }, { 'name': 'Image Shape', 'type': 'str', 'value': 'unknown', 'readonly': True }, { 'name': 'Image Friedel Score', 'type': 'float', 'readonly': True }, { 'name': 'Curve Length', 'type': 'int', 'readonly': 'True' }] }, { 'name': 'Basic Operation', 'type': 'group', 'children': [{ 'name': 'Image', 'type': 'group', 'children': [ { 'name': 'Axis', 'type': 'list', 'values': ['x', 'y', 'z'], 'value': self.axis }, { 'name': 'Frame Index', 'type': 'int', 'value': self.frameIndex }, { 'name': 'Apply Mask', 'type': 'bool', 'value': self.imageLog }, { 'name': 'Apply Log', 'type': 'bool', 'value': self.maskFlag }, { 'name': 'Apply FFT', 'type': 'bool', 'value': self.FFT }, { 'name': 'Apply FFT-SHIFT', 'type': 'bool', 'value': self.FFTSHIFT }, { 'name': 'Binaryzation', 'type': 'bool', 'value': self.binaryFlag }, { 'name': 'Threshold', 'type': 'float', 'value': self.dispThreshold }, { 'name': 'Center x', 'type': 'int', 'value': self.center[1] }, { 'name': 'Center y', 'type': 'int', 'value': self.center[0] }, { 'name': 'Show Rings', 'type': 'bool' }, { 'name': 'Ring Radiis', 'type': 'str', 'value': '' }, ] }, { 'name': 'Curve Plot', 'type': 'group', 'children': [ { 'name': 'TODO', 'type': 'str' }, ] }] }, { 'name': 'Image to Feature Profile', 'type': 'group', 'children': [{ 'name': 'Show Profile', 'type': 'bool', 'value': self.showProfile }, { 'name': 'Feature', 'type': 'list', 'values': ['radial', 'angular', 'across center line'], 'value': self.profileType }, { 'name': 'Profile Mode', 'type': 'list', 'values': ['sum', 'mean'], 'value': self.profileMode }, { 'name': 'Angular Option', 'type': 'group', 'children': [ { 'name': 'R min', 'type': 'float', 'value': self.angularRmin }, { 'name': 'R max', 'type': 'float', 'value': self.angularRmax }, ] }, { 'name': 'Across Center Line Option', 'type': 'group', 'children': [ { 'name': 'Angle', 'type': 'float', 'value': self.lineAngle }, { 'name': 'Width/pixel', 'type': 'int', 'value': self.lineWidth }, ] }, { 'name': 'Smoothing', 'type': 'group', 'children': [ { 'name': 'Enable Smoothing', 'type': 'bool', 'value': self.smoothFlag }, { 'name': 'Window Size', 'type': 'int', 'value': self.smoothWinSize }, { 'name': 'Poly-Order', 'type': 'int', 'value': self.polyOrder }, ] }, { 'name': 'Extrema Search', 'type': 'group', 'children': [ { 'name': 'Enable Extrema Search', 'type': 'bool', 'value': self.extremaSearch }, { 'name': 'Extrema Type', 'type': 'list', 'values': ['max', 'min'], 'value': self.extremaType }, { 'name': 'Extrema WinSize', 'type': 'int', 'value': self.extremaWinSize }, { 'name': 'Extrema Threshold', 'type': 'float', 'value': self.extremaThreshold }, ] }] }, { 'name': 'Small Data', 'type': 'group', 'children': [ { 'name': 'Filepath', 'type': 'str' }, { 'name': 'Dataset', 'type': 'str' }, { 'name': 'Show data', 'type': 'bool', 'value': self.showSmallData }, { 'name': 'Sort', 'type': 'bool', 'value': self.smallDataSorted }, ] }, { 'name': 'Display Option', 'type': 'group', 'children': [ { 'name': 'Image', 'type': 'group', 'children': [ { 'name': 'autoRange', 'type': 'bool', 'value': self.imageAutoRange }, { 'name': 'autoLevels', 'type': 'bool', 'value': self.imageAutoLevels }, { 'name': 'autoHistogramRange', 'type': 'bool', 'value': self.imageAutoHistogramRange }, ] }, { 'name': 'Curve Plot', 'type': 'group', 'children': [ { 'name': 'autoRange', 'type': 'bool', 'value': self.curvePlotAutoRange }, { 'name': 'Log', 'type': 'bool', 'value': self.curvePlotLog }, ] }, { 'name': 'Profile Plot', 'type': 'group', 'children': [ { 'name': 'autoRange', 'type': 'bool', 'value': self.profilePlotAutoRange }, { 'name': 'Log', 'type': 'bool', 'value': self.profilePlotLog }, ] }, { 'name': 'Small Data Plot', 'type': 'group', 'children': [ { 'name': 'autoRange', 'type': 'bool', 'value': self.smallDataPlotAutoRange }, { 'name': 'Log', 'type': 'bool', 'value': self.smallDataPlotLog }, ] }, ] }] self.params = Parameter.create(name='params', type='group', children=params_list) self.ui.parameterTree.setParameters(self.params, showTop=False) self.ui.fileList.itemDoubleClicked.connect(self.changeDatasetSlot) self.ui.fileList.customContextMenuRequested.connect( self.showFileMenuSlot) self.ui.imageView.scene.sigMouseMoved.connect(self.mouseMoved) self.smallDataItem.sigClicked.connect(self.smallDataClicked) self.ui.lineEdit.returnPressed.connect(self.addFilesSlot) self.params.param('Basic Operation', 'Image', 'Axis').sigValueChanged.connect(self.axisChangedSlot) self.params.param('Basic Operation', 'Image', 'Frame Index').sigValueChanged.connect( self.frameIndexChangedSlot) self.params.param('Basic Operation', 'Image', 'Apply Mask').sigValueChanged.connect( self.applyMaskSlot) self.params.param('Basic Operation', 'Image', 'Apply Log').sigValueChanged.connect( self.applyImageLogSlot) self.params.param('Basic Operation', 'Image', 'Binaryzation').sigValueChanged.connect( self.binaryImageSlot) self.params.param('Basic Operation', 'Image', 'Apply FFT').sigValueChanged.connect( self.applyFFTSlot) self.params.param('Basic Operation', 'Image', 'Apply FFT-SHIFT').sigValueChanged.connect( self.applyFFTSHIFTSlot) self.params.param('Basic Operation', 'Image', 'Binaryzation').sigValueChanged.connect( self.binaryImageSlot) self.params.param('Basic Operation', 'Image', 'Threshold').sigValueChanged.connect( self.setDispThresholdSlot) self.params.param('Basic Operation', 'Image', 'Center x').sigValueChanged.connect( self.centerXChangedSlot) self.params.param('Basic Operation', 'Image', 'Center y').sigValueChanged.connect( self.centerYChangedSlot) self.params.param('Basic Operation', 'Image', 'Show Rings').sigValueChanged.connect( self.showRingsSlot) self.params.param('Basic Operation', 'Image', 'Ring Radiis').sigValueChanged.connect( self.ringRadiiSlot) self.params.param('Image to Feature Profile', 'Show Profile').sigValueChanged.connect( self.showProfileSlot) self.params.param('Image to Feature Profile', 'Feature').sigValueChanged.connect( self.setProfileTypeSlot) self.params.param('Image to Feature Profile', 'Profile Mode').sigValueChanged.connect( self.setProfileModeSlot) self.params.param('Image to Feature Profile', 'Angular Option', 'R min').sigValueChanged.connect( self.setAngularRminSlot) self.params.param('Image to Feature Profile', 'Angular Option', 'R max').sigValueChanged.connect( self.setAngularRmaxSlot) self.params.param( 'Image to Feature Profile', 'Across Center Line Option', 'Angle').sigValueChanged.connect(self.setLineAngleSlot) self.params.param( 'Image to Feature Profile', 'Across Center Line Option', 'Width/pixel').sigValueChanged.connect(self.setLineWidthSlot) self.params.param('Image to Feature Profile', 'Smoothing', 'Enable Smoothing').sigValueChanged.connect( self.setSmoothSlot) self.params.param('Image to Feature Profile', 'Smoothing', 'Window Size').sigValueChanged.connect( self.setWinSizeSlot) self.params.param('Image to Feature Profile', 'Smoothing', 'Poly-Order').sigValueChanged.connect( self.setPolyOrderSlot) self.params.param('Image to Feature Profile', 'Extrema Search', 'Enable Extrema Search').sigValueChanged.connect( self.setExtremaSearchSlot) self.params.param('Image to Feature Profile', 'Extrema Search', 'Extrema Type').sigValueChanged.connect( self.setExtremaTypeSlot) self.params.param('Image to Feature Profile', 'Extrema Search', 'Extrema WinSize').sigValueChanged.connect( self.setExtremaWinSizeSlot) self.params.param('Image to Feature Profile', 'Extrema Search', 'Extrema Threshold').sigValueChanged.connect( self.setExtremaThresholdSlot) self.params.param('Small Data', 'Filepath').sigValueChanged.connect( self.setSmallDataFilepathSlot) self.params.param('Small Data', 'Dataset').sigValueChanged.connect( self.setSmallDatasetSlot) self.params.param('Small Data', 'Show data').sigValueChanged.connect( self.showSmallDataSlot) self.params.param('Small Data', 'Sort').sigValueChanged.connect( self.sortSmallDataSlot) self.params.param('Display Option', 'Image', 'autoRange').sigValueChanged.connect( self.imageAutoRangeSlot) self.params.param('Display Option', 'Image', 'autoLevels').sigValueChanged.connect( self.imageAutoLevelsSlot) self.params.param('Display Option', 'Image', 'autoHistogramRange').sigValueChanged.connect( self.imageAutoHistogramRangeSlot) self.params.param('Display Option', 'Curve Plot', 'autoRange').sigValueChanged.connect( self.curvePlotAutoRangeSlot) self.params.param('Display Option', 'Curve Plot', 'Log').sigValueChanged.connect( self.curvePlotLogModeSlot) self.params.param('Display Option', 'Profile Plot', 'autoRange').sigValueChanged.connect( self.profilePlotAutoRangeSlot) self.params.param('Display Option', 'Profile Plot', 'Log').sigValueChanged.connect( self.profilePlotLogModeSlot) self.params.param('Display Option', 'Small Data Plot', 'autoRange').sigValueChanged.connect( self.smallDataPlotAutoRangeSlot) self.params.param('Display Option', 'Small Data Plot', 'Log').sigValueChanged.connect( self.smallDataPlotLogModeSlot)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show()
def __init__(self): super(MyUi, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) #cwd = os.getcwd() #cwd = str(cwd) #if os.path.isfile(cwd+"/time"): # with open("time","r") as outfile:#reads current time # history = cPickle.load(outfile) # if (datetime.now()-history).total_seconds()<43200: #measures if time elapse>12 hours # print "Less than 12 hours. Loading previously saved Json..." # with open("time","w") as infile: #update time # cPickle.dump(datetime.now(),infile) #else: # print "More than 12 hours. Updating Json..." # data = ts.get_industry_classified() # data.to_json(cwd + "/class.json", orient="columns")#writes class data so no need to call Tushare agian #now = datetime.now() #with open("time", "w+") as outfile: #update time # cPickle.dump(now, outfile) # else: # print "No json found!"#If this is first time using tuchart in this directory # data = df() # data = ts.get_industry_classified() # print data # var = data.to_json(cwd+"/class.json",orient="columns") # with open('class.json', 'w+') as outfile: #records json # json.dump(var, outfile) # now = datetime.now() # with open("time", "w+") as outfile: # cPickle.dump(now,outfile) # series = pd.read_json(cwd + "\\class.json") series = ts.get_industry_classified() series = pd.DataFrame(series) curdate = time.strftime( "%Y/%m/%d") #gets current time to put into dateedit dateobj = datetime.strptime(curdate, "%Y/%m/%d") #converts to datetime object past = dateobj - timedelta(days=7) #minus a week to start date pasttime = datetime.strftime(past, "%Y/%m/%d") QPast = QDate.fromString( pasttime, "yyyy/MM/dd") #convert to qtime so that widget accepts the values Qcurdate = QDate.fromString(curdate, "yyyy/MM/dd") #print series list1 = series["c_name"].tolist( ) #Get industry categories. Filters out redundant ones list1 = list(set(list1)) #w = database() #zsparent = QTreeWidgetItem(self.ui.treeWidget) #zsparent.setText(0,"股票指数") #zsnames =["上证指数-sh","深圳成指-sz","沪深300指数-hs300","上证50-"] for j in list1: parent = QTreeWidgetItem( self.ui.treeWidget) #populate treewidget with names parent.setText(0, j) var = series.loc[series["c_name"] == j] list2 = var["code"].tolist() name = var["name"].tolist() #var = showcollection(i) #Display database items for idx, val in enumerate(list2): child = QTreeWidgetItem(parent) child.setText(0, name[idx] + "-" + str(val)) #for i in Drag: #grandson = QTreeWidgetItem(child) #Commented out because increases program response time #grandson.setText(0, i) #self.ui.treeWidget.itemDoubleClicked.connect(self.onClickItem) #Display Collection items self.ui.treeWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeWidget.customContextMenuRequested.connect(self.openMenu) #self.ui.widget.setGeometry(QtCore.QRect(0, 30,1550, 861)) file_path = os.path.abspath( os.path.join(os.path.dirname(__file__), "render.html")) #path to read html file local_url = QUrl.fromLocalFile(file_path) self.ui.widget.load(local_url) self.ui.commandLinkButton.setFixedSize(50, 50) self.ui.commandLinkButton.clicked.connect( self.classify) #when the arrow button is clicked, trigger events #self.ui.commandLinkButton.clicked.connect(lambda action: self.classify(action, self.ui.treewidget)) # QSizePolicy retain_size = self.ui.dateEdit_2.sizePolicy() retain_size.setRetainSizeWhenHidden(True) self.ui.dateEdit_2.setSizePolicy(retain_size) retain_size = self.ui.comboBox.sizePolicy() retain_size.setRetainSizeWhenHidden(True) self.ui.comboBox.setSizePolicy(retain_size) retain_size = self.ui.label_2.sizePolicy() retain_size.setRetainSizeWhenHidden(True) self.ui.label_2.setSizePolicy(retain_size) self.ui.dateEdit.setDate(QPast) self.ui.dateEdit_2.setDate(Qcurdate) #populate widgets self.ui.dateEdit.setCalendarPopup(True) self.ui.dateEdit_2.setCalendarPopup(True) self.ui.comboBox.addItems(["D", "W", "M", "5", "15", "30", "60"]) self.ui.treeWidget_2.setDragDropMode(self.ui.treeWidget_2.InternalMove) self.ui.treeWidget_2.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeWidget_2.customContextMenuRequested.connect( self.openWidgetMenu) #self.ui.toolbutton.clicked.connect(lambda action: self.graphmerge(action, CombineKeyword)) self.ui.combobox.currentIndexChanged.connect(self.modifycombo)
def __init__(self): LOGGER.info('========== New Start ==========') super().__init__() self.components = Ui_MainWindow() self.components.setupUi(self) self.components.path_input.setText( '/Users/flicker_soul/Documents/Python Demo/LibWork/test/test.xlsx') self.components.pub_end_row.setText('1405') self.components.lib_end_row.setText('1573') LOGGER.debug('Initialize Components') self.show() LOGGER.debug('Show Window') def call_file_chooser(): fd = QtWidgets.QFileDialog() fd.setFileMode(QtWidgets.QFileDialog.AnyFile) fd.setNameFilter('Excel File (*.xlsx)') if fd.exec_(): filenames = fd.selectedFiles() if len(filenames) > 1: LOGGER.warning( 'Chose Many Files Only The First One Will Be Used') elif len(filenames) < 1: LOGGER.info('No File Chose') return path = filenames[0] self.components.path_input.setText(path) LOGGER.debug('Set File Path To ' + path) return LOGGER.info('No File Chose') def call_file_saver(): fd = QtWidgets.QFileDialog() fd.setAcceptMode(QtWidgets.QFileDialog.AcceptSave) if fd.exec_(): filenames = fd.selectedFiles() if len(filenames) > 1: LOGGER.warning( 'Multiple Save Target Chose, Only The First One Will Be Used' ) elif len(filenames) < 1: LOGGER.info('No File Chose') return '' path = filenames[0] return path LOGGER.info('No File Chose') return '' self.components.open_button.clicked.connect(call_file_chooser) LOGGER.debug('Setup File Chooser') self.disable_group = [ self.components.sheet_name_input, self.components.pub_title_input, self.components.lib_title_input, # self.components.letter_only_button, # self.components.no_space_button, # self.components.strict_button, self.components.correct_color_box, self.components.ambiguous_color_box, self.components.wrong_color_box ] self.components.letter_only_button.setDisabled(True) self.components.no_space_button.setDisabled(True) self.components.strict_button.setDisabled(True) LOGGER.debug('Defined Disable Group') self.id_group = [ self.components.pub_id_input, self.components.lib_id_input ] LOGGER.debug('Defined Id Group') self.color_group = [ self.components.correct_color_box, self.components.ambiguous_color_box, self.components.wrong_color_box ] LOGGER.debug('Defined Color Group') COLOR_SET = data.output_color_name() for color_box in self.color_group: color_box.addItems(COLOR_SET) self.components.correct_color_box.setCurrentIndex( self.components.correct_color_box.findText('green')) self.components.ambiguous_color_box.setCurrentIndex( self.components.ambiguous_color_box.findText('yellow')) self.components.wrong_color_box.setCurrentIndex( self.components.wrong_color_box.findText('red')) LOGGER.debug('Setup Color Choices') def change_disable_status(): dis_flag = self.components.use_user_enter_button.isChecked() id_flag = self.components.use_id_button.isChecked() for element in self.disable_group: element.setDisabled(not dis_flag) for element in self.id_group: element.setDisabled(not (id_flag and dis_flag)) change_disable_status() self.components.use_user_enter_button.clicked.connect( change_disable_status) LOGGER.debug('Setup Use User Data Button') def change_id_status(): dis_flag = self.components.use_user_enter_button.isChecked() id_flag = self.components.use_id_button.isChecked() for element in self.id_group: element.setDisabled(not (id_flag and dis_flag)) self.components.use_id_button.clicked.connect(change_id_status) LOGGER.debug('Setup Use Id Button') def start_helper(): is_using_id_compare = self.components.use_id_button.isChecked() is_using_user_defined_data = self.components.use_user_enter_button.isChecked( ) if not is_using_id_compare: show_warning_dialog( 'You Are Not Using ID Compare', 'Using Title Only Will Compromise Accuracy') if is_using_user_defined_data: show_warning_dialog('You Are Using Self-Defined Data', 'Some Unknown Error May Occur') file_path = self.components.path_input.text() work_book_wrapper = None try: work_book_wrapper = data.WorkBookWrapper( work_book_file_path=file_path) except Exception: LOGGER.debug(msg='Invalid File', stack_info=traceback.format_exc()) show_critical_dialog('Invalid File', 'Must Use Valid Excel File (*.xlsx)') return False, None pub_id_col = data.WorkBookWrapper.PUB_ID_COL lib_id_col = data.WorkBookWrapper.LIB_ID_COL if is_using_id_compare: pub_id_col = self.components.pub_id_input.text() lib_id_col = self.components.lib_id_input.text() LOGGER.debug(('' if is_using_id_compare else 'Not ') + 'Use Id Compare') LOGGER.debug('\n' + 'Publisher\'s Id Col is ' + pub_id_col + '\n' + 'Lib\'s Id Col is ' + lib_id_col + '\n') data_sheet_name = data.WorkBookWrapper.DEFAULT_DATA_SHEET_NAME pub_title_col = data.WorkBookWrapper.PUB_TITLE_COL lib_title_col = data.WorkBookWrapper.LIB_TITLE_COL is_using_no_weird_letters = False is_using_no_space = False is_using_strict_mode = False correct_color = data.WorkBookWrapper.DEFAULT_CORRECT_COLOR ambiguous_color = data.WorkBookWrapper.DEFAULT_AMBIGUOUS_COLOR wrong_color = data.WorkBookWrapper.DEFAULT_WRONG_COLOR if is_using_user_defined_data: data_sheet_name = self.components.sheet_name_input.text() pub_title_col = self.components.pub_title_input.text() lib_title_col = self.components.lib_title_input.text() is_using_no_weird_letters = self.components.letter_only_button.isChecked( ) is_using_no_space = self.components.no_space_button.isChecked() is_using_strict_mode = self.components.strict_button.isChecked( ) correct_color = self.components.correct_color_box.currentText() ambiguous_color = self.components.ambiguous_color_box.currentText( ) wrong_color = self.components.wrong_color_box.currentText() LOGGER.debug(('' if is_using_user_defined_data else 'Not ') + 'Using User Defined Data') LOGGER.debug('\n' + 'Data Sheet Name is ' + data_sheet_name + '\n' + 'Publisher\'s Title Col is ' + pub_title_col + '\n' + 'Lib\'s Title Col is ' + lib_title_col + '\n' + 'Using Weird letters? ' + str(is_using_no_weird_letters) + '\n' + 'Using No Space Mode? ' + str(is_using_no_space) + '\n' + 'Using Strict Mode? ' + str(is_using_strict_mode) + '\n' + 'Correct Color: ' + correct_color + '\n' + 'Ambiguous Color: ' + ambiguous_color + '\n' + 'Wrong Color: ' + wrong_color + '\b') pub_end_row = self.components.pub_end_row.text() lib_end_row = self.components.lib_end_row.text() LOGGER.debug('\n' + 'Publisher\'s End Row is ' + pub_end_row + '\n' + 'Lib\'s End Row is ' + lib_end_row + '\n') LOGGER.debug('Wrapping Up Data') try: work_book_wrapper.set_pub_id_col( self.components.pub_id_input.text()) work_book_wrapper.set_lib_id_col( self.components.lib_id_input.text()) work_book_wrapper.set_data_sheet(data_sheet_name) work_book_wrapper.set_pub_title_col(pub_title_col) work_book_wrapper.set_lib_title_col(lib_title_col) work_book_wrapper.set_no_weird_letter_flag( is_using_no_weird_letters) work_book_wrapper.set_no_space_flag(is_using_no_space) work_book_wrapper.set_strict_mode_flag(is_using_strict_mode) work_book_wrapper.set_correct_color(correct_color) work_book_wrapper.set_ambiguous_color(ambiguous_color) work_book_wrapper.set_wrong_color(wrong_color) work_book_wrapper.set_pub_end_row(pub_end_row) work_book_wrapper.set_lib_end_row(lib_end_row) except AssertionError: LOGGER.critical(msg='Not Valid Letters', stack_info=traceback.format_exc()) show_critical_dialog('Not Valid Letters', 'You Must Use English Letters') except KeyError: LOGGER.critical(msg='No Data Sheet As ' + data_sheet_name + 'Exists', stack_info=traceback.format_exc()) show_critical_dialog( 'No Data Sheet As ' + data_sheet_name + 'Exists', 'Your Data Sheet Input Is Not Valid') except ValueError: LOGGER.critical(msg='Invalid End Row Input', stack_info=traceback.format_exc()) show_critical_dialog( 'Invalid End Row Input', 'You Need To Input A Valid Number As End Row') else: LOGGER.info('Start Working') return work_book_wrapper.work(), work_book_wrapper return False, None def start(): self.components.start_button.setDisabled(True) LOGGER.debug('Disable Start Button') show_info_dialog('Choose Output File Afterward', 'Please Select Output File Path Afterward') save_path = call_file_saver() if not save_path: LOGGER.warning('Nothing Will Be Saved') show_warning_dialog('No Save File Selected', 'Nothing Will Be Saved') LOGGER.info('The Save Path Is ' + save_path) LOGGER.info('Save Work Book as ' + save_path) result = False wb = None try: start_time = time.time() result, wb = start_helper() LOGGER.info('Running Time: ' + str(time.time() - start_time) + 'S') except Exception: LOGGER.critical(msg='Unknown Error', stack_info=traceback.format_exc()) show_critical_dialog( 'Unknown Error', 'Unknown Error Occurred; Please Contact Developer') finally: self.components.start_button.setDisabled(False) LOGGER.debug('Unlock Start Button') LOGGER.info('SUCCESSFULLY EXECUTED: ' + str(result)) if result: show_info_dialog( 'Comparing Completed', 'SUCCESSFULLY EXECUTED: ' + str(result).upper()) if wb is not None and save_path: wb.work_book.save(save_path) LOGGER.info('File Saved As ' + save_path) else: show_critical_dialog('Comparing Not Complete', 'Something Went Wrong') self.components.start_button.clicked.connect(start)