class ElementAllegroMonitored(QFrame): def __init__(self, name, link, is_done, price, xpath, time, is_monitoring, parent=None, shared_dict=None): QFrame.__init__(self, parent) self.shared_dict = shared_dict self.setMinimumSize(QSize(0, 300)) self.setStyleSheet("""QFrame{border-bottom: 0.5px solid #aaa;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self) # create description frame and layout self.frame_description = QFrame(self) self.frame_description.setMinimumSize(QSize(440, 16777215)) self.frame_description.setStyleSheet("""QFrame{border: none;}""") self.frame_description.setFrameShape(QFrame.StyledPanel) self.frame_description.setFrameShadow(QFrame.Raised) self.gridLayout_description = QGridLayout(self.frame_description) self.horizontalLayout.addWidget(self.frame_description) self.gridLayout_description.setColumnStretch(0, 1) self.gridLayout_description.setColumnStretch(1, 2) self.gridLayout_description.setColumnStretch(2, 3) self.gridLayout_description.setColumnStretch(3, 1) self.gridLayout_description.setColumnStretch(4, 6) # fill description layout self.label_name = QLabel(name, self.frame_description) self.label_name.setStyleSheet(styles.label_allegro_monitored_name) self.label_name.setTextFormat(Qt.MarkdownText) self.label_name.setAlignment(Qt.AlignJustify | Qt.AlignVCenter) self.label_name.setWordWrap(False) self.gridLayout_description.addWidget(self.label_name, 0, 0, 1, 5) self.url_link = "<a href=\"" + link + "\" style = \" color: #838836; text-decoration: none; font-family:corbel; title=\"Go to monitored page\"\">check product</a>" self.label_monitored_link = QLabel(url_link, self.frame_description) self.label_monitored_link.setStyleSheet(styles.label_allegro_monitored_link) self.gridLayout_description.addWidget(self.label_monitored_link, 1, 1, 2, 2) self.label_monitored_link.setOpenExternalLinks(True) self.label_stat = QLabel(self.frame_description) self.label_stat.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_stat, 1, 4, 1, 1) self.label_is_on = QLabel(self.frame_description) self.label_is_on.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_on, 5, 0, 1, 2) self.label_new_time = QLabel("Actual refresh time[s]: " + str(time)+" s", self.frame_description) self.label_new_time.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_time, 4, 0, 1, 3) self.lineEdit_new_time = QLineEdit(self.frame_description) self.lineEdit_new_time.setMinimumSize(QSize(0, 33)) self.lineEdit_new_time.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_time, 4, 3, 1, 2) self.lineEdit_new_time.setPlaceholderText("Set new interval") self.label_new_price = QLabel("Actual price: " + str(price), self) self.label_new_price.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_price, 3, 0, 1, 3) self.lineEdit_new_price = QLineEdit(self) self.lineEdit_new_price.setMinimumSize(QSize(0, 35)) self.lineEdit_new_price.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_price, 3, 3, 1, 2) self.lineEdit_new_price.setPlaceholderText("Set new price") self.label_img_link = QLabel(self.frame_description) self.label_img_link.setMaximumSize(QSize(20, 20)) self.label_img_link.setStyleSheet("""QLabel{border: none;}""") self.label_img_link.setPixmap(QPixmap(os.path.join(path, "img/link.png"))) self.label_img_link.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_link, 1, 0, 2, 1) self.label_img_stat = QLabel("done", self.frame_description) if is_done: self.label_stat.setText("done") self.label_img_stat.setPixmap(QPixmap(os.path.join(path, "img/check.png"))) else: self.label_stat.setText("in progress") self.label_img_stat.setPixmap(QPixmap(os.path.join(path, "img/loading.png"))) self.label_img_stat.setMaximumSize(QSize(20, 20)) self.label_img_stat.setStyleSheet("""QLabel{border: none;}""") self.label_img_stat.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_stat, 1, 3, 1, 1) self.label_img_monitor = QLabel("done", self.frame_description) if is_monitoring: monitor_text = "I am just monitoring" self.label_img_monitor.setPixmap(QPixmap(os.path.join(path, "img/monitoring.png"))) else: monitor_text = "I am going to buy" self.label_img_monitor.setPixmap(QPixmap(os.path.join(path, "img/buy.png"))) self.label_is_monitoring = QLabel(monitor_text, self) self.label_is_monitoring.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_monitoring, 2, 4, 1, 1) self.label_img_monitor.setMaximumSize(QSize(20, 20)) self.label_img_monitor.setStyleSheet("""QLabel{border: none;}""") self.label_img_monitor.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_monitor, 2, 3, 1, 1) # create spacer and delete btn self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.spacer) self.pushButton_delete = QPushButton(self) # self.pushButton_delete.clicked.connect( lambda: self.deleteLater()) self.pushButton_delete.clicked.connect(lambda: self.on_delete(link)) icon = QIcon() icon.addFile(os.path.join(path, "img/delete.png"), QSize(), QIcon.Selected, QIcon.Off) # icon.Active.addFile(os.path.join(path, "img/icon.png"), QSize(), QIcon.Selected, QIcon.Off) self.pushButton_delete.setIcon(icon) self.pushButton_delete.setIconSize(QSize(50, 50)) self.pushButton_delete.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_delete.setCursor(QCursor(Qt.PointingHandCursor)) # self.pushButton_delete.ico self.horizontalLayout.addWidget(self.pushButton_delete) self.is_on = data.get_switch_state(link) self.pushButton_switch = QPushButton(self) self.pushButton_switch.clicked.connect(lambda: self.on_switch(link)) self.icon_on = QIcon() self.icon_off = QIcon() self.icon_on.addFile(os.path.join(path, "img/switch_on.png"), QSize(), QIcon.Selected, QIcon.On) self.icon_off.addFile(os.path.join(path, "img/switch_off.png"), QSize(), QIcon.Selected, QIcon.Off) if self.is_on: self.label_is_on.setText("Disable") self.pushButton_switch.setIcon(self.icon_on) else: self.label_is_on.setText("Enable") self.pushButton_switch.setIcon(self.icon_off) self.pushButton_switch.setIconSize(QSize(100, 40)) self.pushButton_switch.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_switch.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_switch, 5, 2, 1, 1) self.pushButton_save_changes = QPushButton("Save", self) self.pushButton_save_changes.clicked.connect(lambda: self.on_save_changes(link)) self.pushButton_save_changes.setIconSize(QSize(100, 20)) self.pushButton_save_changes.setStyleSheet(styles.btn_dark) self.pushButton_save_changes.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_save_changes, 5, 3, 1, 2) def on_delete(self, link): data.delete_monitored_element(link) self.deleteLater() self.shared_dict['isTerminatedP2'] = True def on_save_changes(self, link): data.change_price_time(link, self.lineEdit_new_price.text(), self.lineEdit_new_time.text()) if self.lineEdit_new_price.text() != '': self.label_new_price.setText("Actual price: " + self.lineEdit_new_price.text()) if self.lineEdit_new_time.text() != '': self.label_new_time.setText("Actual refresh time[s]: " + self.lineEdit_new_time.text() + " s") self.lineEdit_new_time.clear() self.lineEdit_new_price.clear() self.shared_dict['isTerminatedP2'] = True def on_switch(self, link): # m.stop_run_monitor() if self.is_on: self.label_is_on.setText("Enable") self.pushButton_switch.setIcon(self.icon_off) self.is_on = False data.switch_state(self.is_on, link) else: self.label_is_on.setText("Disable") self.pushButton_switch.setIcon(self.icon_on) self.is_on = True data.switch_state(self.is_on, link) self.shared_dict['isTerminatedP2'] = True
class DataBrowserMain(QWidget): sliceUpdated = Signal(int, int, int, int) def __init__(self, parent): super(DataBrowserMain, self).__init__(parent) # data import self.brkraw_obj = self.parent().brkraw_obj self.selectedScan = None self.selectedScanTR = None self.set_viewer_frame() self.set_controller_frame() self.set_gridlayouts() self.set_font() # self.set_palette() # TODO self.set_size() self.set_objectnames() self.set_texts() self.ratio_container = [] self.init_connection() self.inactivate_widgets() # Inactivate during startup def init_connection(self): self.parent().dataSelected.connect( self.selectScanEvent) # run selectScanEvent when data selected self.event_timer = QTimer() self.event_timer.timeout.connect(self.sliceUpdateEvent) # self.sliceUpdated.connect(self.updateImage) self.xaxis_slider.valueChanged.connect(self.xaxis_spinbox.setValue) self.xaxis_spinbox.valueChanged.connect(self.xaxis_slider.setValue) self.yaxis_slider.valueChanged.connect(self.yaxis_spinbox.setValue) self.yaxis_spinbox.valueChanged.connect(self.yaxis_slider.setValue) self.zaxis_slider.valueChanged.connect(self.zaxis_spinbox.setValue) self.zaxis_spinbox.valueChanged.connect(self.zaxis_slider.setValue) self.frame_slider.valueChanged.connect(self.frame_spinbox.setValue) self.frame_spinbox.valueChanged.connect(self.frame_slider.setValue) self.axial_view.pointed.connect(self.axialview_pointing_event) self.sagittal_view.pointed.connect(self.sagittalview_pointing_event) self.coronal_view.pointed.connect(self.coronalview_pointing_event) self.connect_sliders_to_update() def sagittalview_pointing_event(self, pos_x, pos_y, meta): max_x = self.yaxis_slider.maximum() max_y = self.zaxis_slider.maximum() # print(pos_x, pos_y, max_x, max_y) self.yaxis_slider.setValue(int(max_x * pos_x)) self.zaxis_slider.setValue(max_y - int(max_y * pos_y)) # print(int(max_x * pos_x), int(max_y * pos_y)) def axialview_pointing_event(self, pos_x, pos_y, meta): max_x = self.yaxis_slider.maximum() max_y = self.xaxis_slider.maximum() # print(pos_x, pos_y, max_x, max_y) self.yaxis_slider.setValue(int(max_x * pos_x)) self.xaxis_slider.setValue(int(max_y * pos_y)) # print(int(max_x * pos_x), int(max_y * pos_y)) def coronalview_pointing_event(self, pos_x, pos_y, meta): max_x = self.xaxis_slider.maximum() max_y = self.zaxis_slider.maximum() # print(pos_x, pos_y, max_x, max_y) self.xaxis_slider.setValue(int(max_x * pos_x)) self.zaxis_slider.setValue(max_y - int(max_y * pos_y)) # print(int(max_x * pos_x), int(max_y * pos_y)) def sliderChangeEvent(self): self.event_timer.start(10) def sliceUpdateEvent(self): # This will executed only when timer timeout x = self.xaxis_slider.value() y = self.yaxis_slider.value() z = self.zaxis_slider.value() t = self.frame_slider.value() self.sliceUpdated.emit(x, y, z, t) self.event_timer.stop() @staticmethod def slice_data(dataobj, slice_orient, slice_num): if slice_orient == 'axial': sliced_data = dataobj[:, :, slice_num] elif slice_orient == 'sagittal': sliced_data = dataobj[:, slice_num, ::-1] elif slice_orient == 'coronal': sliced_data = dataobj[slice_num, :, ::-1] else: popup_error_dialog(UnexpectedError.message) return None return sliced_data def updateImage(self, x, y, z, frame): if len(self.selectedScan.shape) == 4: dataobj = self.selectedScan[:, :, :, frame] else: dataobj = self.selectedScan[...] data_xy = self.slice_data(dataobj, 'axial', z) data_yz = self.slice_data(dataobj, 'sagittal', x) data_xz = self.slice_data(dataobj, 'coronal', y) ratio_xy, ratio_yz, ratio_xz = self.ratio_container # ratio_xy, ratio_yz, ratio_xz = 1, 1, 1 qm_xy = convert_arr2qpixmap(data_xy, ratio_xy) qm_yz = convert_arr2qpixmap(data_yz, ratio_yz) qm_xz = convert_arr2qpixmap(data_xz, ratio_xz) self.axial_view.setPixmap(qm_xy) self.sagittal_view.setPixmap(qm_yz) self.coronal_view.setPixmap(qm_xz) def selectScanEvent(self, delivery_package: list): """ this event is occurring when a scan selected on scanlist """ self.axial_view.setEnabled(True) self.sagittal_view.setEnabled(True) self.coronal_view.setEnabled(True) self.selectedScan, affine, resol, self.selectedScanTR, is_localizer = delivery_package self.selectedScanTR /= 1000 from slfmri.imgman import reorient_to_ras, determine_slice_plane slice_plane_ref = dict(sagittal=0, coronal=1, axial=2) if is_localizer: img_container = dict() for i, aff in enumerate(affine): size = config.get('ImageViewer', 'size') data = self.selectedScan[..., i] slice_plane = determine_slice_plane(2, aff, resol) ras_data, ras_resol = reorient_to_ras(data[:, :, np.newaxis], aff, resol) slice_axis = slice_plane_ref[slice_plane] ras_data = ras_data.mean(slice_axis) ras_resol = np.delete(ras_resol, slice_axis) qpixmap = convert_arr2qpixmap(ras_data, ras_resol, size) img_container[slice_plane] = qpixmap self.update_axisview(img_container) else: # other than localizer self.init_data(self.selectedScan) matrix_size = np.asarray(self.selectedScan.shape) resol = np.asarray(resol) fov = matrix_size[:3] * resol self.ratio_container = [ fov[0] / fov[1], fov[1] / fov[2], fov[0] / fov[2] ] # reset value init_x, init_y, init_z = (np.asarray(self.selectedScan.shape[:3]) / 2.0).astype(int) init_f = 0 self.disconnect_sliders_to_update() self.xaxis_slider.setValue(init_x) self.yaxis_slider.setValue(init_y) self.zaxis_slider.setValue(init_z) self.frame_slider.setValue(init_f) self.connect_sliders_to_update() self.updateImage(init_x, init_y, init_z, init_f) def connect_sliders_to_update(self): # connect to check slice update self.xaxis_slider.valueChanged.connect(self.sliderChangeEvent) self.yaxis_slider.valueChanged.connect(self.sliderChangeEvent) self.zaxis_slider.valueChanged.connect(self.sliderChangeEvent) self.frame_slider.valueChanged.connect(self.sliderChangeEvent) def disconnect_sliders_to_update(self): # disconnect to check slice update self.xaxis_slider.valueChanged.disconnect(self.sliderChangeEvent) self.yaxis_slider.valueChanged.disconnect(self.sliderChangeEvent) self.zaxis_slider.valueChanged.disconnect(self.sliderChangeEvent) self.frame_slider.valueChanged.disconnect(self.sliderChangeEvent) def init_data(self, dataobj): self.slicecontrol_pane.setEnabled(True) dim = len(dataobj.shape) if dim == 3: size_x, size_y, size_z = dataobj.shape size_frame = None elif dim == 4: size_x, size_y, size_z, size_frame = dataobj.shape else: popup_error_dialog(UnexpectedError.message) return None # init sliders and spinboxes self.xaxis_slider.setRange(0, size_x - 1) self.yaxis_slider.setRange(0, size_y - 1) self.zaxis_slider.setRange(0, size_z - 1) self.xaxis_spinbox.setRange(0, size_x - 1) self.yaxis_spinbox.setRange(0, size_y - 1) self.zaxis_spinbox.setRange(0, size_z - 1) if dim == 3: self.frame_label.setDisabled(True) self.frame_slider.setDisabled(True) self.frame_spinbox.setDisabled(True) else: self.frame_label.setEnabled(True) self.frame_slider.setEnabled(True) self.frame_spinbox.setEnabled(True) self.frame_slider.setRange(0, size_frame - 1) self.frame_spinbox.setRange(0, size_frame - 1) def update_axisview(self, img_container: dict): for view_plane, pixmap in img_container.items(): if view_plane == 'axial': self.axial_view.setPixmap(pixmap) elif view_plane == 'sagittal': self.sagittal_view.setPixmap(pixmap) else: self.coronal_view.setPixmap(pixmap) def inactivate_widgets(self): self.slicecontrol_pane.setDisabled(True) self.graph_frame.setDisabled(True) def set_navigationmode(self): # mouse click will navigate slice. pass def set_drawingmode(self): # roi drawing function pass def mask_data_handler(self): # mask later handler pass def slider_event_related(self): # slider for slicing. pass def set_viewer_frame(self): self.imageframe = QFrame(self) self.axial_view = SliceViewer(self.imageframe) self.axial_view.setDisabled(True) self.sagittal_view = SliceViewer(self.imageframe) self.sagittal_view.setDisabled(True) self.coronal_view = SliceViewer(self.imageframe) self.coronal_view.setDisabled(True) # TODO: Will reactivate these on later version # self.axial_title = QLabel(self.imageframe) # self.coronal_title = QLabel(self.imageframe) # self.sagittal_title = QLabel(self.imageframe) # # self.axialL_label = QLabel(self.imageframe) # self.axialA_label = QLabel(self.imageframe) # self.axialR_label = QLabel(self.imageframe) # self.axialP_label = QLabel(self.imageframe) # # self.sagittalS_label = QLabel(self.imageframe) # self.sagittalA_label = QLabel(self.imageframe) # self.sagittalI_label = QLabel(self.imageframe) # self.sagittalP_label = QLabel(self.imageframe) # # self.coronalL_label = QLabel(self.imageframe) # self.coronalS_label = QLabel(self.imageframe) # self.coronalR_label = QLabel(self.imageframe) # self.coronalI_label = QLabel(self.imageframe) # # self.axial_title.setTextFormat(Qt.MarkdownText) # self.axialL_label.setTextFormat(Qt.MarkdownText) # self.axialA_label.setTextFormat(Qt.MarkdownText) # self.axialR_label.setTextFormat(Qt.MarkdownText) # self.axialP_label.setTextFormat(Qt.MarkdownText) # # self.sagittal_title.setTextFormat(Qt.MarkdownText) # self.sagittalS_label.setTextFormat(Qt.MarkdownText) # self.sagittalA_label.setTextFormat(Qt.MarkdownText) # self.sagittalI_label.setTextFormat(Qt.MarkdownText) # self.sagittalP_label.setTextFormat(Qt.MarkdownText) # # self.coronal_title.setTextFormat(Qt.MarkdownText) # self.coronalL_label.setTextFormat(Qt.MarkdownText) # self.coronalS_label.setTextFormat(Qt.MarkdownText) # self.coronalR_label.setTextFormat(Qt.MarkdownText) # self.coronalI_label.setTextFormat(Qt.MarkdownText) # # self.axial_title.setAlignment(Qt.AlignCenter) # self.axialL_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) # self.axialA_label.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) # self.axialR_label.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignVCenter) # self.axialP_label.setAlignment(Qt.AlignHCenter | Qt.AlignTop) # # self.sagittal_title.setAlignment(Qt.AlignCenter) # self.sagittalS_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) # self.sagittalA_label.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) # self.sagittalI_label.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignVCenter) # self.sagittalP_label.setAlignment(Qt.AlignHCenter | Qt.AlignTop) # # self.coronal_title.setAlignment(Qt.AlignCenter) # self.coronalL_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) # self.coronalS_label.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) # self.coronalR_label.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignVCenter) # self.coronalI_label.setAlignment(Qt.AlignHCenter | Qt.AlignTop) def set_controller_frame(self): self.controller_frame = QFrame(self) self.slicecontrol_pane = QGroupBox(self.controller_frame) self.frame_spinbox = QSpinBox(self.slicecontrol_pane) self.xaxis_label = QLabel(self.slicecontrol_pane) self.yaxis_label = QLabel(self.slicecontrol_pane) self.zaxis_label = QLabel(self.slicecontrol_pane) self.frame_label = QLabel(self.slicecontrol_pane) self.xaxis_slider = QSlider(self.slicecontrol_pane) self.yaxis_slider = QSlider(self.slicecontrol_pane) self.zaxis_slider = QSlider(self.slicecontrol_pane) self.frame_slider = QSlider(self.slicecontrol_pane) self.xaxis_spinbox = QSpinBox(self.slicecontrol_pane) self.yaxis_spinbox = QSpinBox(self.slicecontrol_pane) self.zaxis_spinbox = QSpinBox(self.slicecontrol_pane) self.graph_frame = QFrame(self) self.graph_view = pg.PlotWidget(self.graph_frame) self.graph_view.setBackground('w') # TODO: Will reactivate these on later version # self.graph_view = QGraphicsView(self.graph_frame) # self.graphcontrol_pane = QGroupBox(self.graph_frame) # self.addmask_button = QPushButton(self.graphcontrol_pane) # self.removemask_button = QPushButton(self.graphcontrol_pane) # self.mask_listview = QListView(self.graphcontrol_pane) # self.savepng_button = QPushButton(self.graphcontrol_pane) # self.savecsv_button = QPushButton(self.graphcontrol_pane) self.axial_view.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.sagittal_view.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.coronal_view.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.xaxis_slider.setOrientation(Qt.Horizontal) self.yaxis_slider.setOrientation(Qt.Horizontal) self.zaxis_slider.setOrientation(Qt.Horizontal) self.frame_slider.setOrientation(Qt.Horizontal) self.slicecontrol_pane.setAlignment(Qt.AlignCenter) self.xaxis_label.setAlignment(Qt.AlignCenter) self.yaxis_label.setAlignment(Qt.AlignCenter) self.zaxis_label.setAlignment(Qt.AlignCenter) self.frame_label.setAlignment(Qt.AlignCenter) # TODO: Will reactivate these on later version # self.graphcontrol_pane.setAlignment(Qt.AlignCenter) def set_size(self): size = int(config.get('ImageViewer', 'size')) self.imageframe.setLineWidth(0) self.axial_view.setMinimumSize(QSize(size, size)) self.axial_view.setMaximumSize(QSize(size, size)) self.axial_view.setLineWidth(0) self.sagittal_view.setMinimumSize(QSize(size, size)) self.sagittal_view.setMaximumSize(QSize(size, size)) self.sagittal_view.setLineWidth(0) self.coronal_view.setMinimumSize(QSize(size, size)) self.coronal_view.setMaximumSize(QSize(size, size)) self.coronal_view.setLineWidth(0) # TODO: Will reactivate these on later version # self.axialL_label.setMinimumSize(QSize(20, 0)) # self.axialA_label.setMinimumSize(QSize(0, 20)) # self.axialR_label.setMinimumSize(QSize(20, 0)) # self.axialP_label.setMinimumSize(QSize(0, 20)) # self.sagittalS_label.setMinimumSize(QSize(20, 0)) # self.sagittalA_label.setMinimumSize(QSize(0, 20)) # self.sagittalI_label.setMinimumSize(QSize(20, 0)) # self.sagittalP_label.setMinimumSize(QSize(0, 20)) # self.coronalL_label.setMinimumSize(QSize(20, 0)) # self.coronalS_label.setMinimumSize(QSize(0, 20)) # self.coronalR_label.setMinimumSize(QSize(20, 0)) # self.coronalI_label.setMinimumSize(QSize(0, 20)) self.controller_frame.setMinimumSize(QSize(300, 300)) self.controller_frame.setMaximumSize(QSize(400, 300)) self.graph_frame.setMinimumSize(QSize(0, 300)) self.graph_frame.setMaximumSize(QSize(4000, 4000)) self.graph_view.setMaximumSize(QSize(4000, 600)) # TODO: Will reactivate these on later version # self.graphcontrol_pane.setMinimumSize(QSize(300, 0)) # self.graphcontrol_pane.setMaximumSize(QSize(300, 4000)) # self.addmask_button.setMinimumSize(QSize(30, 0)) # self.addmask_button.setMaximumSize(QSize(30, 4000)) # self.removemask_button.setMinimumSize(QSize(30, 0)) # self.removemask_button.setMaximumSize(QSize(30, 4000)) def set_font(self): self.arial_8 = QFont() self.arial_8.setFamily(u"Arial") self.arial_8.setPointSize(8) self.setFont(self.arial_8) # TODO: Will reactivate these on later version # self.axial_title.setFont(self.arial_8) # self.coronal_title.setFont(self.arial_8) # self.sagittal_title.setFont(self.arial_8) # self.axialL_label.setFont(self.arial_8) # self.axialA_label.setFont(self.arial_8) # self.axialR_label.setFont(self.arial_8) # self.axialP_label.setFont(self.arial_8) # self.sagittalS_label.setFont(self.arial_8) # self.sagittalA_label.setFont(self.arial_8) # self.sagittalI_label.setFont(self.arial_8) # self.sagittalP_label.setFont(self.arial_8) # self.coronalL_label.setFont(self.arial_8) # self.coronalS_label.setFont(self.arial_8) # self.coronalR_label.setFont(self.arial_8) # self.coronalI_label.setFont(self.arial_8) self.slicecontrol_pane.setFont(self.arial_8) # TODO: Will reactivate these on later version # self.xaxis_label.setFont(self.arial_8) # self.yaxis_label.setFont(self.arial_8) # self.zaxis_label.setFont(self.arial_8) # self.frame_label.setFont(self.arial_8) # self.graphcontrol_pane.setFont(self.arial_8) # self.addmask_button.setFont(self.arial_8) # self.removemask_button.setFont(self.arial_8) # self.savepng_button.setFont(self.arial_8) # self.savecsv_button.setFont(self.arial_8) def set_palette(self): # Brush gray_text = QBrush(QColor(171, 171, 171, 255)) gray_text.setStyle(Qt.SolidPattern) black_background = QBrush(QColor(0, 0, 0, 255)) black_background.setStyle(Qt.SolidPattern) self.orientation_label_palette = QPalette() self.orientation_label_palette.setBrush(QPalette.Active, QPalette.WindowText, gray_text) self.orientation_label_palette.setBrush(QPalette.Inactive, QPalette.WindowText, gray_text) self.orientation_label_palette.setBrush(QPalette.Disabled, QPalette.WindowText, gray_text) self.ortho_viewer_palette = QPalette() self.ortho_viewer_palette.setBrush(QPalette.Active, QPalette.Base, black_background) self.ortho_viewer_palette.setBrush(QPalette.Inactive, QPalette.Base, black_background) self.ortho_viewer_palette.setBrush(QPalette.Disabled, QPalette.Base, black_background) self.axialA_label.setPalette(self.orientation_label_palette) self.axialL_label.setPalette(self.orientation_label_palette) self.axialR_label.setPalette(self.orientation_label_palette) self.axialP_label.setPalette(self.orientation_label_palette) self.axial_view.setPalette(self.ortho_viewer_palette) self.sagittalS_label.setPalette(self.orientation_label_palette) self.sagittalA_label.setPalette(self.orientation_label_palette) self.sagittalI_label.setPalette(self.orientation_label_palette) self.sagittalP_label.setPalette(self.orientation_label_palette) self.sagittal_view.setPalette(self.ortho_viewer_palette) self.coronalL_label.setPalette(self.orientation_label_palette) self.coronalS_label.setPalette(self.orientation_label_palette) self.coronalR_label.setPalette(self.orientation_label_palette) self.coronalI_label.setPalette(self.orientation_label_palette) self.coronal_view.setPalette(self.ortho_viewer_palette) def set_gridlayouts(self): self.axial_gridLayout = QGridLayout() self.coronal_gridLayout = QGridLayout() self.sagittal_gridLayout = QGridLayout() self.imagecont_gridLayout = QGridLayout(self.slicecontrol_pane) self.imageframe_gridLayout = QGridLayout(self.imageframe) # self.graphcontrol_gridLayout = QGridLayout(self.graphcontrol_pane) self.verticalLayout = QVBoxLayout(self.controller_frame) self.horizontalLayout = QHBoxLayout(self.graph_frame) self.main_gridLayout = QGridLayout(self) # TODO: Will reactivate these on later version # self.imageframe_gridLayout.addWidget(self.axial_title, 0, 1, 1, 1) # self.imageframe_gridLayout.addWidget(self.coronal_title, 0, 2, 1, 1) # self.imageframe_gridLayout.addWidget(self.sagittal_title, 0, 0, 1, 1) # self.axial_gridLayout.addWidget(self.axialL_label, 1, 0, 1, 1) # self.axial_gridLayout.addWidget(self.axialA_label, 0, 1, 1, 1) # self.axial_gridLayout.addWidget(self.axialR_label, 1, 2, 1, 1) # self.axial_gridLayout.addWidget(self.axialP_label, 2, 1, 1, 1) self.axial_gridLayout.addWidget(self.axial_view, 1, 1, 1, 1) # self.sagittal_gridLayout.addWidget(self.sagittalS_label, 1, 0, 1, 1) # self.sagittal_gridLayout.addWidget(self.sagittalA_label, 0, 1, 1, 1) # self.sagittal_gridLayout.addWidget(self.sagittalI_label, 1, 2, 1, 1) # self.sagittal_gridLayout.addWidget(self.sagittalP_label, 2, 1, 1, 1) self.sagittal_gridLayout.addWidget(self.sagittal_view, 1, 1, 1, 1) # self.coronal_gridLayout.addWidget(self.coronalL_label, 1, 0, 1, 1) # self.coronal_gridLayout.addWidget(self.coronalS_label, 0, 1, 1, 1) # self.coronal_gridLayout.addWidget(self.coronalR_label, 1, 2, 1, 1) # self.coronal_gridLayout.addWidget(self.coronalI_label, 2, 1, 1, 1) self.coronal_gridLayout.addWidget(self.coronal_view, 1, 1, 1, 1) self.imagecont_gridLayout.addWidget(self.xaxis_label, 0, 0, 1, 1) self.imagecont_gridLayout.addWidget(self.xaxis_slider, 0, 1, 1, 1) self.imagecont_gridLayout.addWidget(self.xaxis_spinbox, 0, 2, 1, 1) self.imagecont_gridLayout.addWidget(self.yaxis_label, 1, 0, 1, 1) self.imagecont_gridLayout.addWidget(self.yaxis_slider, 1, 1, 1, 1) self.imagecont_gridLayout.addWidget(self.yaxis_spinbox, 1, 2, 1, 1) self.imagecont_gridLayout.addWidget(self.zaxis_label, 2, 0, 1, 1) self.imagecont_gridLayout.addWidget(self.zaxis_slider, 2, 1, 1, 1) self.imagecont_gridLayout.addWidget(self.zaxis_spinbox, 2, 2, 1, 1) self.imagecont_gridLayout.addWidget(self.frame_label, 3, 0, 1, 1) self.imagecont_gridLayout.addWidget(self.frame_slider, 3, 1, 1, 1) self.imagecont_gridLayout.addWidget(self.frame_spinbox, 3, 2, 1, 1) self.imageframe_gridLayout.addLayout(self.axial_gridLayout, 1, 1, 1, 1) self.imageframe_gridLayout.addLayout(self.coronal_gridLayout, 1, 2, 1, 1) self.imageframe_gridLayout.addLayout(self.sagittal_gridLayout, 1, 0, 1, 1) # self.graphcontrol_gridLayout.addWidget(self.addmask_button, 3, 0, 1, 1) # self.graphcontrol_gridLayout.addWidget(self.removemask_button, 3, 1, 1, 1) # self.graphcontrol_gridLayout.addWidget(self.mask_listview, 0, 0, 1, 5) # self.graphcontrol_gridLayout.addWidget(self.savepng_button, 3, 4, 1, 1) # self.graphcontrol_gridLayout.addWidget(self.savecsv_button, 3, 3, 1, 1) self.verticalLayout.addWidget(self.slicecontrol_pane) self.horizontalLayout.addWidget(self.graph_view) # self.horizontalLayout.addWidget(self.graphcontrol_pane) self.main_gridLayout.addWidget(self.imageframe, 0, 0, 1, 2) self.main_gridLayout.addWidget(self.controller_frame, 1, 0, 1, 1) self.main_gridLayout.addWidget(self.graph_frame, 1, 1, 1, 1) def set_objectnames(self): self.setObjectName(u"data_browser") self.imageframe.setObjectName(u"image_frame") self.axial_gridLayout.setObjectName(u"axial_gridLayout") self.coronal_gridLayout.setObjectName(u"coronal_gridLayout") self.sagittal_gridLayout.setObjectName(u"sagittal_gridLayout") # TODO: Will reactivate these on later version # self.axial_title.setObjectName(u"axial_label") # self.coronal_title.setObjectName(u"coronal_label") # self.sagittal_title.setObjectName(u"sagittal_label") self.axial_view.setObjectName(u"axial_view") self.sagittal_view.setObjectName(u"sagittal_view") self.coronal_view.setObjectName(u"coronal_view") # self.axialL_label.setObjectName(u"axialL_label") # self.axialR_label.setObjectName(u"axialR_label") # self.axialA_label.setObjectName(u"axialA_label") # self.axialP_label.setObjectName(u"axialP_label") # self.sagittalS_label.setObjectName(u"sagittalS_label") # self.sagittalA_label.setObjectName(u"sagittalA_label") # self.sagittalI_label.setObjectName(u"sagittalI_label") # self.sagittalP_label.setObjectName(u"sagittalP_label") # self.coronalL_label.setObjectName(u"coronalL_label") # self.coronalS_label.setObjectName(u"coronalS_label") # self.coronalR_label.setObjectName(u"coronalR_label") # self.coronalI_label.setObjectName(u"coronalI_label") self.controller_frame.setObjectName(u"controller_frame") self.slicecontrol_pane.setObjectName(u"slicecontrol_pane") self.xaxis_label.setObjectName(u"xaxis_label") self.xaxis_slider.setObjectName(u"xaxis_slider") self.xaxis_spinbox.setObjectName(u"xaxis_spinbox") self.yaxis_label.setObjectName(u"yaxis_label") self.yaxis_slider.setObjectName(u"yaxis_slider") self.yaxis_spinbox.setObjectName(u"yaxis_spinbox") self.zaxis_label.setObjectName(u"zaxis_label") self.zaxis_slider.setObjectName(u"zaxis_slider") self.zaxis_spinbox.setObjectName(u"zaxis_spinbox") self.frame_label.setObjectName(u"frame_label") self.frame_slider.setObjectName(u"frame_slider") self.frame_spinbox.setObjectName(u"frame_spinbox") self.graph_frame.setObjectName(u"graph_frame") self.graph_view.setObjectName(u"graph_view") # TODO: Will reactivate these on later version # self.graphcontrol_pane.setObjectName(u"graphcontrol_pane") # self.addmask_button.setObjectName(u"addmask_button") # self.removemask_button.setObjectName(u"removemask_button") # self.mask_listview.setObjectName(u"mask_listview") # self.savepng_button.setObjectName(u"savepng_button") # self.savecsv_button.setObjectName(u"savecsv_button") self.imagecont_gridLayout.setObjectName(u"imagecont_gridLayout") self.imageframe_gridLayout.setObjectName(u"imageframe_gridLayout") # self.graphcontrol_gridLayout.setObjectName(u"graphcontrol_gridLayout") self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout.setObjectName(u"horizontalLayout") self.main_gridLayout.setObjectName(u"main_gridLayout") QMetaObject.connectSlotsByName(self) def set_texts(self): self.setWindowTitle(u"Data Browser") # TODO: Will reactivate these on later version # self.axial_title.setText(u"**Axial**") # self.coronal_title.setText(u"**Coronal**") # self.sagittal_title.setText(u"**Sagittal**") # self.sagittalS_label.setText(u"**S**") # self.sagittalA_label.setText(u"**A**") # self.sagittalI_label.setText(u"**I**") # self.sagittalP_label.setText(u"**P**") # self.axialL_label.setText(u"**L**") # self.axialA_label.setText(u"**A**") # self.axialR_label.setText(u"**R**") # self.axialP_label.setText( u"**P**") # self.coronalL_label.setText(u"**L**") # self.coronalS_label.setText(u"**S**") # self.coronalR_label.setText(u"**R**") # self.coronalI_label.setText(u"**I**") self.slicecontrol_pane.setTitle(u"Slice Control Pane") self.xaxis_label.setText(u"x") self.yaxis_label.setText(u"y") self.zaxis_label.setText(u"z") self.frame_label.setText(u"Frame") # TODO: Will reactivate these on later version # self.graphcontrol_pane.setTitle(u"Graph Control Pane") # self.addmask_button.setText(u"+") # self.removemask_button.setText(u"-") # self.savepng_button.setText(u"toPNG") # self.savecsv_button.setText(u"toCSV") def plot_timecourse(self, x, y): self.graph_frame.setEnabled(True) self.graph_view.clear() pen = pg.mkPen(color=(255, 0, 0)) if x is None: x = [0] y = [y] self.graph_view.plot(x, y, pen=pen, symbol='o') else: self.graph_view.plot(x, y, pen=pen) def get_coord(self): x = self.xaxis_slider.value() y = self.yaxis_slider.value() z = self.zaxis_slider.value() return (x, y, z)
class Camera(QWidget): modes = (('Manual', 0, 0), ('Optimize for traffic (aggressive)', 60, 10), ('Optimize for traffic (moderate)', 120, 25), ('Optimize for latency (aggressive)', 60, 80), ('Optimize for latency (moderate)', 120, 80), ('Optimize for video quality', 480, 30)) def __init__(self, id, app: QApplication, *args, **kwargs): super().__init__(*args, **kwargs) self.id = id self.image_quality = CONFIGURATIONS['cameras']['cam%d' % id]['quality'] self.image_resolution = CONFIGURATIONS['cameras']['cam%d' % id]['resolution'] self.box = QVBoxLayout() self.setLayout(self.box) self.tabs = QTabWidget() self.camera_feed = CameraFeed(self.id, app) self.status_frame = QFrame() self.status_frame.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.status_frame.setMinimumSize(250, 340) self.status = QScrollArea() self.status.setWidget(self.status_frame) self.initStatus() self.network_graphs = pg.GraphicsLayoutWidget() self.traffic_graphs = pg.GraphicsLayoutWidget() self.frame_rate_graphs = pg.GraphicsLayoutWidget() self.initGraphs() self.box.addWidget(self.tabs) self.tabs.addTab(self.camera_feed, 'Camera') self.tabs.addTab(self.status, 'Status') self.tabs.addTab(self.traffic_graphs, "Traffic") self.tabs.addTab(self.network_graphs, "Latency") self.tabs.addTab(self.frame_rate_graphs, "Video") self.setMinimumSize(1, 1) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.timer = QTimer() self.timer.timeout.connect(self.updateAllGraphs) self.timer.start(100) def initStatus(self): self.status_layout = QGridLayout() self.status_frame.setLayout(self.status_layout) self.serverTime = QLabel() self.clientTime = QLabel() self.totalTime = QLabel() self.networkTime = QLabel() self.clientTime.setText('0.000 ms') self.serverTime.setText('0.000 ms') self.totalTime.setText('0.000 ms') self.networkTime.setText('0.000 ms') self.fps = QLabel() self.fps.setText('0.000 FPS') self.traffic = QLabel() self.traffic.setText('0.000 KB/s') self.frame_drop = QLabel() self.frame_drop.setText('0 FPS') # self.status_layout.addWidget(self.fps, 0, 0) self.status_layout.addWidget(QLabel("Frame Rate"), 0, 0) self.status_layout.addWidget(self.fps, 0, 1) self.status_layout.addWidget(QLabel("Frame Drop"), 1, 0) self.status_layout.addWidget(self.frame_drop, 1, 1) self.status_layout.addWidget(QLabel("Server"), 2, 0) self.status_layout.addWidget(self.serverTime, 2, 1) self.status_layout.addWidget(QLabel("Client"), 3, 0) self.status_layout.addWidget(self.clientTime, 3, 1) self.status_layout.addWidget(QLabel("Network"), 4, 0) self.status_layout.addWidget(self.networkTime, 4, 1) self.status_layout.addWidget(QLabel("Total"), 5, 0) self.status_layout.addWidget(self.totalTime, 5, 1) self.status_layout.addWidget(QLabel("Traffic"), 6, 0) self.status_layout.addWidget(self.traffic, 6, 1) self.mode_selection = QComboBox() self.mode_selection.wheelEvent = self.status.wheelEvent # Monkey patch it so the selection doesn't change self.mode_selection.setEnabled(False) self.mode_selection.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) for i, mode in enumerate(self.modes): self.mode_selection.addItem(mode[0]) if self.image_resolution == mode[1] and self.image_quality == mode[ 2]: self.mode_selection.setCurrentIndex(i) self.status_layout.addWidget(self.mode_selection, 7, 0, columnspan=2) self.mode_selection.currentIndexChanged.connect(self.updateMode) self.quality_slider = QSlider(Qt.Horizontal) self.quality_slider.setMinimum(1) self.quality_slider.setMaximum(80) self.quality_slider.setSingleStep(1) self.quality_slider.setValue(self.image_quality) self.quality_slider.wheelEvent = self.status.wheelEvent self.quality_slider.setEnabled(False) self.quality_label = QLabel(str(self.image_quality)) self.quality_slider.valueChanged.connect( lambda n: self.quality_label.setText(str(n))) self.resolution_slider = QSlider(Qt.Horizontal, ) self.resolution_slider.setMinimum(60) self.resolution_slider.setMaximum(1080) self.resolution_slider.setSingleStep(120) self.resolution_slider.setValue(self.image_resolution) self.resolution_slider.wheelEvent = self.status.wheelEvent self.resolution_slider.setEnabled(False) self.resolution_label = QLabel(str(self.image_resolution)) self.resolution_slider.valueChanged.connect( lambda n: self.resolution_label.setText(str(n))) self.status_layout.addWidget(QLabel("Image Quality"), 8, 0, columnspan=2) self.status_layout.addWidget(self.quality_slider, 9, 0) self.status_layout.addWidget(self.quality_label, 9, 1) self.status_layout.addWidget(QLabel("Image Resolution"), 10, 0, columnspan=2) self.status_layout.addWidget(self.resolution_slider, 11, 0) self.status_layout.addWidget(self.resolution_label, 11, 1) self.apply_button = QPushButton("Apply") self.apply_button.setEnabled(False) self.status_layout.addWidget(self.apply_button, 12, 0) self.apply_button.clicked.connect(self.updateConfiguration) def updateMode(self, index): mode_name, resolution, quality = self.modes[index] if mode_name == 'Manual': self.apply_button.setEnabled(True) self.resolution_slider.setEnabled(True) self.quality_slider.setEnabled(True) else: self.apply_button.setEnabled(False) self.resolution_slider.setEnabled(False) self.quality_slider.setEnabled(False) self.resolution_slider.setValue(resolution) self.quality_slider.setValue(quality) self.updateConfiguration() def updateConfiguration(self): try: Configuration().update_config(self.id, self.resolution_slider.value(), self.quality_slider.value()) except (ConnectionResetError, BrokenPipeError): Configuration().reconnect() def initGraphs(self): self.traffic_plot = StatusPlotItem() self.traffic_plot.setTitle("Traffic") self.traffic_plot.setLabel("left", 'Data Transmitted', 'KB/s') self.traffic_graphs.addItem(self.traffic_plot, row=0, col=0) self.network_plot = StatusPlotItem() self.network_plot.setTitle("Network Time") self.network_plot.setLabel( "left", "Latency (ms)", ) self.network_graphs.addItem(self.network_plot, row=0, col=2) self.client_time_plot = StatusPlotItem() self.client_time_plot.setTitle("Client Time") self.client_time_plot.setLabel( "left", "Latency (ms)", ) self.network_graphs.addItem(self.client_time_plot, row=0, col=1) self.total_time_plot = StatusPlotItem() self.total_time_plot.setTitle("Total Latency") self.total_time_plot.setLabel( "left", "Latency (ms)", ) self.network_graphs.addItem(self.total_time_plot, row=0, col=0) self.frame_rate_plot = StatusPlotItem() self.frame_rate_plot.setLabel('left', 'Frame Per Second') self.frame_rate_plot.setTitle("Frame Rate") self.frame_rate_graphs.addItem(self.frame_rate_plot, row=0, col=0) self.frame_drop_plot = StatusPlotItem() self.frame_rate_plot.setLabel('left', 'Frame Per Second') self.frame_drop_plot.setTitle('Frame Drop') self.frame_rate_graphs.addItem(self.frame_drop_plot, row=0, col=1) def updateStatus(self, total, server, client): self.totalTime.setText('{: <4} ms'.format(str(total))) self.total_time_plot.value = total self.serverTime.setText('{: <4} ms'.format(str(server))) self.clientTime.setText('{: <4} ms'.format(str(client))) self.client_time_plot.value = client self.networkTime.setText('{: <4} ms'.format( str(round(total - server - client, 2)))) self.network_plot.value = total - server - client self.traffic.setText('{: <4} KB/s'.format( str(round(getattr(TrafficMonitor(), 'cam%d' % self.id) / 1024, 1)))) self.traffic_plot.value = getattr(TrafficMonitor(), 'cam%d' % self.id) / 1024 self.fps.setText('{: <4} FPS'.format( str(round(getattr(FrameRateMonitor(), 'cam%d' % self.id), 1)))) self.frame_rate_plot.value = getattr(FrameRateMonitor(), 'cam%d' % self.id) self.frame_drop_plot.value = getattr(FrameDropMonitor(), 'cam%d' % self.id) self.frame_drop.setText('{: <4} FPS'.format( str(round(getattr(FrameDropMonitor(), 'cam%d' % self.id), 1)))) # self.updateAllGraphs() def updateAllGraphs(self): self.total_time_plot.update() self.client_time_plot.update() self.frame_rate_plot.update() self.frame_drop_plot.update() self.network_plot.update() self.traffic_plot.update() def startReceiving(self): self.camera_feed.startReceiving() self.time_started = time.time() self.camera_feed.feed_receiver.signals.updateStatus.connect( self.updateStatus)
class NavFrame(QFrame): def __init__(self, parent=None): QFrame.__init__(self, parent) self.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.frame_nav = QFrame(self) self.frame_nav.setMinimumSize(QSize(220, 300)) self.frame_nav.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.frame_nav.setFrameShape(QFrame.StyledPanel) self.frame_nav.setFrameShadow(QFrame.Raised) self.gridLayout = QGridLayout(self) self.gridLayout.setContentsMargins(11, -1, 11, -1) self.gridLayout.addWidget(self.frame_nav, 3, 0, 1, 4) # set program img and name self.label_img = QLabel(self) self.label_img.setFixedSize(QSize(60, 60)) self.label_img.setPixmap(QPixmap(os.path.join(path, 'img/icon.png'))) # self.label_img.setPixmap(QPixmap("../img/icon.png")) self.label_img.setScaledContents(True) self.gridLayout.addWidget(self.label_img, 2, 1, 1, 1) self.label_name = QLabel("WebCheck ", self) self.label_name.setStyleSheet(styles.label_icon_name) self.gridLayout.addWidget(self.label_name, 2, 2, 1, 1) self.spacer_name_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_t = QSpacerItem(20, 70, QSizePolicy.Minimum, QSizePolicy.Maximum) self.gridLayout.addItem(self.spacer_name_l, 2, 0, 1, 1) self.gridLayout.addItem(self.spacer_name_r, 2, 3, 1, 1) self.gridLayout.addItem(self.spacer_name_t, 1, 1, 1, 2) # set bottom layout for keeping gb in it self.gridLayout_b = QGridLayout(self.frame_nav) self.spacer_gb_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_t = QSpacerItem(0, 20, QSizePolicy.Minimum, QSizePolicy.Maximum) self.spacer_gb_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout_b.addItem(self.spacer_gb_l, 1, 2, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_r, 1, 0, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_t, 0, 1, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_b, 2, 1, 1, 1) # set gb and radio buttons self.groupBox = QGroupBox("", self.frame_nav) self.gridLayout_b.addWidget(self.groupBox, 1, 1, 1, 1) self.groupBox.setMinimumSize(QSize(220, 350)) self.groupBox.setStyleSheet("""QGroupBox{background-image: url(ui/img/radioline.png); border: none;}""") self.verticalLayout_gb = QVBoxLayout(self.groupBox) self.radioButton_add = QRadioButton(" Add", self.groupBox) self.radioButton_add.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_add) self.radioButton_monitored = QRadioButton(" Monitored", self.groupBox) self.radioButton_monitored.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_monitored) self.radioButton_options = QRadioButton(" Options", self.groupBox) self.radioButton_options.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_options) self.radioButton_about = QRadioButton(" About", self.groupBox) self.radioButton_about.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_about)
class Ui_Error(object): def setupUi(self, Error): if not Error.objectName(): Error.setObjectName(u"Error") Error.resize(250, 150) Error.setMinimumSize(QSize(250, 150)) Error.setMaximumSize(QSize(250, 150)) self.horizontalLayout = QHBoxLayout(Error) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.frame = QFrame(Error) self.frame.setObjectName(u"frame") self.frame.setStyleSheet(u"background:rgb(51,51,51);") self.frame.setFrameShape(QFrame.NoFrame) self.frame.setFrameShadow(QFrame.Plain) self.verticalLayout = QVBoxLayout(self.frame) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.frame_top = QFrame(self.frame) self.frame_top.setObjectName(u"frame_top") self.frame_top.setMinimumSize(QSize(0, 55)) self.frame_top.setMaximumSize(QSize(16777215, 55)) self.frame_top.setStyleSheet(u"background:rgb(91,90,90);") self.frame_top.setFrameShape(QFrame.NoFrame) self.frame_top.setFrameShadow(QFrame.Plain) self.horizontalLayout_2 = QHBoxLayout(self.frame_top) self.horizontalLayout_2.setSpacing(5) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(15, 5, 0, 0) self.lab_icon = QLabel(self.frame_top) self.lab_icon.setObjectName(u"lab_icon") self.lab_icon.setMinimumSize(QSize(35, 35)) self.lab_icon.setMaximumSize(QSize(35, 35)) self.horizontalLayout_2.addWidget(self.lab_icon) self.lab_heading = QLabel(self.frame_top) self.lab_heading.setObjectName(u"lab_heading") font = QFont() font.setFamily(u"Segoe UI") font.setPointSize(12) self.lab_heading.setFont(font) self.lab_heading.setStyleSheet(u"color:rgb(255,255,255);") self.lab_heading.setWordWrap(True) self.horizontalLayout_2.addWidget(self.lab_heading) self.verticalLayout.addWidget(self.frame_top) self.frame_bottom = QFrame(self.frame) self.frame_bottom.setObjectName(u"frame_bottom") self.frame_bottom.setStyleSheet(u"background:rgb(91,90,90);") self.frame_bottom.setFrameShape(QFrame.NoFrame) self.frame_bottom.setFrameShadow(QFrame.Plain) self.gridLayout = QGridLayout(self.frame_bottom) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setContentsMargins(-1, -1, -1, 0) self.bn_ok = QPushButton(self.frame_bottom) self.bn_ok.setObjectName(u"bn_ok") self.bn_ok.setMinimumSize(QSize(69, 25)) self.bn_ok.setMaximumSize(QSize(69, 25)) self.bn_ok.setStyleSheet(u"QPushButton {\n" " border: 2px solid rgb(51,51,51);\n" " border-radius: 5px; \n" " color:rgb(255,255,255);\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(51,51,51);\n" "}\n" "") self.gridLayout.addWidget(self.bn_ok, 0, 0, 1, 1) self.verticalLayout.addWidget(self.frame_bottom) self.horizontalLayout.addWidget(self.frame) self.retranslateUi(Error) QMetaObject.connectSlotsByName(Error) # setupUi def retranslateUi(self, Error): Error.setWindowTitle( QCoreApplication.translate("Error", u"Dialog", None)) self.lab_icon.setText("") self.lab_heading.setText("") self.bn_ok.setText("")
class DLPPrinterGUI(QWidget): closing_window_event = Signal() spinboxValueChanged = Signal(float) def __init__(self, dlp_controller=None, parent=None, printer_setup='BOTTOM-UP'): QWidget.__init__(self, parent) if dlp_controller: self.dlp_controller = dlp_controller else: self.dlp_controller = DLPMainController(printer_setup) self.dlp_controller.block_parameters_signal.connect( self.block_parameters_signals) self.dlp_controller.reactivate_parameters_signal.connect( self.reactivate_parameters_signals) self.dlp_controller.motor_changed_signal.connect( self.update_motor_parameters) self.closing_window_event.connect(self.dlp_controller.close_projector) self.parent = parent self.main_layout = QHBoxLayout() self.__init_widget__() self.setLayout(self.main_layout) def __init_widget__(self): self.__left_widget = QWidget() self.__left_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.MinimumExpanding) self.__right_widget = QWidget() self.__right_widget.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.__init_printer_options_widget__(self.__left_widget) self.__init_projector_widget__(self.__left_widget) self.__init_support_widget__(self.__left_widget) self.__init_features_widget__(self.__left_widget) self.__init_advanced_features_widget__(self.__left_widget) # self.__init_expected_time_widget__(self.__left_widget) self.__left_layout = QGridLayout() self.__left_layout.addWidget(self.__printer_options_widget, 0, 0, 1, 2) self.__left_layout.addWidget(self.__projector_widget, 1, 0, 1, 2) self.__left_layout.addWidget(self.__support_widget, 2, 0, 1, 1) self.__left_layout.addWidget(self.__features_widget, 2, 1, 1, 1) self.__left_layout.addWidget(self.__advanced_widget, 3, 0, 1, 2) # self.__left_layout.addWidget(self.__expected_time_widget, 4,0) self.__left_widget.setLayout(self.__left_layout) self.__left_widget.show() self.__init_start_stop_widget__(self.__right_widget) self.__init_preview_widget__(self.__right_widget) self.__init_console_widget__(self.__right_widget) self.__init_username_jobname_widget__() self.__right_layout = QVBoxLayout() self.__right_layout.addWidget(self.__start_stop_widget) self.__right_layout.addWidget(self.__username_jobname_widget) self.__right_layout.addWidget(self.__preview_widget) self.__right_layout.addWidget(self.__console_widget) self.__right_widget.setLayout(self.__right_layout) # print(self.__left_layout.sizeHint(), self.__right_layout.sizeHint()) self.main_layout.addWidget(self.__left_widget) self.main_layout.addWidget(self.__right_widget) def __init_printer_options_widget__(self, parent=None): self.__printer_options_widget = QGroupBox("Printer Options", parent) # self.__printer_options_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) port_label = QLabel("Port:", self.__printer_options_widget) self.port_list = MyQComboBox(self.__printer_options_widget) self.port_list.addItems(self.dlp_controller.available_ports()) self.port_list.currentIndexChanged.connect( self.dlp_controller.select_port) self.port_list.combo_box_clicked.connect(self.update_port_list) connect_button = QPushButton("Connect", self.__printer_options_widget) connect_button.clicked.connect(self.dlp_controller.connect_printer) disconnect_button = QPushButton("Disconnect", self.__printer_options_widget) disconnect_button.clicked.connect( self.dlp_controller.disconnect_printer) reset_button = QPushButton("Reset", self.__printer_options_widget) reset_button.clicked.connect(self.dlp_controller.reset_printer) move_button = QPushButton("Move Building Plate", self.__printer_options_widget) self.move_edit = MyDiscreteStepsSpinBox( self.dlp_controller.get_step_length_microns() / 1000.0, self.__printer_options_widget) self.move_edit.setSuffix("mm") self.move_edit.setMaximum(1000) self.move_edit.setMinimum(-1000) self.move_edit.setDecimals(6) self.move_edit.my_value_changed_signal.connect( self.dlp_controller.update_building_plate_distance) move_button.clicked.connect(self.dlp_controller.move_building_plate) set_origin_button = QPushButton("Set Building Plate Origin", self.__printer_options_widget) set_origin_button.clicked.connect( self.dlp_controller.set_building_plate_origin) home_button = QPushButton("Home Building Plate", self.__printer_options_widget) home_button.clicked.connect(self.dlp_controller.home_building_plate) origin_button = QPushButton("Send Building Plate to Origin", self.__printer_options_widget) origin_button.clicked.connect( self.dlp_controller.move_building_plate_to_origin) options_layout = QGridLayout(self.__printer_options_widget) # options_layout.addWidget(options_label, 0, 0, 1, 5) options_layout.addWidget(port_label, 0, 0) options_layout.addWidget(self.port_list, 0, 1) options_layout.addWidget(connect_button, 0, 2) options_layout.addWidget(disconnect_button, 0, 3) options_layout.addWidget(reset_button, 0, 4) options_layout.addWidget(move_button, 1, 0, 1, 2) options_layout.addWidget(self.move_edit, 1, 2) options_layout.addWidget(set_origin_button, 1, 3, 1, 2) options_layout.addWidget(home_button, 2, 0, 1, 2) options_layout.addWidget(origin_button, 2, 2, 1, 2) self.__printer_options_widget.setLayout(options_layout) def __init_projector_widget__(self, parent=None): self.__projector_widget = QGroupBox("Projector Options", parent) # self.__projector_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) mirror_x = QCheckBox("Mirror X") mirror_x.setChecked(self.dlp_controller.is_horizontal_mirrored()) mirror_x.toggled.connect(self.dlp_controller.set_horizontal_mirroring) mirror_y = QCheckBox("Mirror Y") mirror_y.setChecked(self.dlp_controller.is_vertical_mirrored()) mirror_y.toggled.connect(self.dlp_controller.set_vertical_mirroring) start_projector_button = QPushButton("Start Projector", self.__projector_widget) start_projector_button.clicked.connect( self.dlp_controller.start_projector) project_pattern_button = QPushButton("Project Pattern", self.__projector_widget) project_pattern_button.clicked.connect( self.dlp_controller.project_calibration_pattern) print_position_button = QPushButton("Print Position", self.__projector_widget) print_position_button.clicked.connect( self.dlp_controller.print_motor_position) home_projector_button = QPushButton("Home Projector", self.__projector_widget) home_projector_button.clicked.connect( self.dlp_controller.home_projector) move_projector_button = QPushButton("Move Projector", self.__projector_widget) move_projector_button.clicked.connect( self.dlp_controller.move_projector) move_projector_edit = QDoubleSpinBox(self.__projector_widget) move_projector_edit.setSuffix("mm") move_projector_edit.setMaximum(10000) move_projector_edit.setMinimum(-10000) move_projector_edit.setDecimals(3) move_projector_edit.setSingleStep(0.001) move_projector_edit.valueChanged.connect( self.dlp_controller.update_projector_distance) set_amplitude_button = QPushButton("Set Projector Amplitude", self.__projector_widget) set_amplitude_button.clicked.connect( self.dlp_controller.set_projector_amplitude) set_amplitude_edit = QSpinBox(self.__projector_widget) set_amplitude_edit.setMaximum(1000) set_amplitude_edit.setMinimum(0) set_amplitude_edit.setValue(self.dlp_controller.projector_amplitude) set_amplitude_edit.valueChanged.connect( self.dlp_controller.update_projector_amplitude) lock_unlock_projector_button = QPushButton("Lock/Unlock Projector", self.__projector_widget) lock_unlock_projector_button.clicked.connect( self.dlp_controller.lock_unlock_projector) projector_layout = QGridLayout(self.__projector_widget) # projector_layout.addWidget(projector_label, 0, 0) projector_layout.addWidget(mirror_x, 0, 1) projector_layout.addWidget(mirror_y, 0, 2) projector_layout.addWidget(start_projector_button, 1, 0, 1, 1) projector_layout.addWidget(project_pattern_button, 1, 1, 1, 1) projector_layout.addWidget(print_position_button, 1, 2, 1, 1) projector_layout.addWidget(home_projector_button, 2, 0, 1, 1) projector_layout.addWidget(move_projector_button, 2, 1, 1, 1) projector_layout.addWidget(move_projector_edit, 2, 2) projector_layout.addWidget(set_amplitude_button, 3, 0, 1, 1) projector_layout.addWidget(set_amplitude_edit, 3, 1) projector_layout.addWidget(lock_unlock_projector_button, 3, 2, 1, 1) self.__projector_widget.setLayout(projector_layout) def __init_support_widget__(self, parent=None): self.__support_widget = QGroupBox("Support Layers Parameters", parent) # self.__support_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) thickness_label = QLabel("Layer Thickness", self.__support_widget) self.support_thickness_edit = MyDiscreteStepsSpinBox( self.dlp_controller.get_step_length_microns(), self.__support_widget) self.support_thickness_edit.setSuffix(str('\u03BCm')) self.support_thickness_edit.setMaximum(1000000) self.support_thickness_edit.setMinimum(0) self.support_thickness_edit.setDecimals(3) self.support_thickness_edit.my_value_changed_signal.connect( self.dlp_controller.set_support_thickness) self.support_thickness_edit.setValue( self.dlp_controller.support_thickness * 1000) exposure_label = QLabel("Exposure Time", self.__support_widget) exposure_edit = QDoubleSpinBox(self.__support_widget) exposure_edit.setSuffix(str('ms')) exposure_edit.setMaximum(10000000) exposure_edit.setMinimum(0) exposure_edit.setDecimals(1) exposure_edit.setSingleStep(0.1) exposure_edit.setValue(self.dlp_controller.support_exposure) exposure_edit.valueChanged.connect( self.dlp_controller.set_support_exposure_time) amplitude_label = QLabel("Light Amplitude", self.__support_widget) amplitude_edit = QSpinBox(self.__support_widget) amplitude_edit.setMaximum(1600) amplitude_edit.setMinimum(0) amplitude_edit.setSingleStep(1) amplitude_edit.setValue(self.dlp_controller.support_amplitude) amplitude_edit.valueChanged.connect( self.dlp_controller.set_support_amplitude) burn_layers_label = QLabel("Burn Layers", self.__support_widget) burn_layers_edit = QSpinBox(self.__support_widget) burn_layers_edit.setMaximum(1000) burn_layers_edit.setMinimum(0) burn_layers_edit.setSingleStep(1) burn_layers_edit.setValue(self.dlp_controller.support_burn_layers) burn_layers_edit.valueChanged.connect( self.dlp_controller.set_support_burning_layers) burn_exposure_label = QLabel("Burn Exposure", self.__support_widget) burn_exposure_edit = QDoubleSpinBox(self.__support_widget) burn_exposure_edit.setSuffix(str('ms')) burn_exposure_edit.setMaximum(100000) burn_exposure_edit.setMinimum(0) burn_exposure_edit.setDecimals(1) burn_exposure_edit.setSingleStep(0.1) burn_exposure_edit.setValue(self.dlp_controller.support_burn_exposure) burn_exposure_edit.valueChanged.connect( self.dlp_controller.set_support_burning_exposure_time) burn_amplitude_label = QLabel("Burn Amplitude", self.__support_widget) burn_amplitude_edit = QSpinBox(self.__support_widget) burn_amplitude_edit.setMaximum(1600) burn_amplitude_edit.setMinimum(0) burn_amplitude_edit.setSingleStep(1) burn_amplitude_edit.setValue( self.dlp_controller.support_burn_amplitude) burn_amplitude_edit.valueChanged.connect( self.dlp_controller.set_support_burning_amplitude) select_layers_button = QPushButton("Select Support Images") select_layers_button.clicked.connect(self.load_support_images) support_layout = QGridLayout(self.__support_widget) support_layout.addWidget(thickness_label, 1, 0) support_layout.addWidget(self.support_thickness_edit, 1, 1) support_layout.addWidget(exposure_label, 2, 0) support_layout.addWidget(exposure_edit, 2, 1) support_layout.addWidget(amplitude_label, 3, 0) support_layout.addWidget(amplitude_edit, 3, 1) support_layout.addWidget(burn_layers_label, 4, 0) support_layout.addWidget(burn_layers_edit, 4, 1) support_layout.addWidget(burn_exposure_label, 5, 0) support_layout.addWidget(burn_exposure_edit, 5, 1) support_layout.addWidget(burn_amplitude_label, 6, 0) support_layout.addWidget(burn_amplitude_edit, 6, 1) support_layout.addWidget(select_layers_button, 7, 0, 1, 2) self.__support_widget.setLayout(support_layout) def __init_features_widget__(self, parent=None): self.__features_widget = QGroupBox("Features Layers Parameters", parent) # self.__features_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) thickness_label = QLabel("Layer Thickness", self.__features_widget) self.features_thickness_edit = MyDiscreteStepsSpinBox( self.dlp_controller.get_step_length_microns(), self.__features_widget) self.features_thickness_edit.setSuffix(str('\u03BCm')) self.features_thickness_edit.setMaximum(1000000) self.features_thickness_edit.setMinimum(0) self.features_thickness_edit.setDecimals(3) self.features_thickness_edit.my_value_changed_signal.connect( self.dlp_controller.set_features_thickness) self.features_thickness_edit.setValue( self.dlp_controller.features_thickness * 1000) exposure_label = QLabel("Exposure Time", self.__features_widget) exposure_edit = QDoubleSpinBox(self.__features_widget) exposure_edit.setSuffix(str('ms')) exposure_edit.setMaximum(10000000) exposure_edit.setMinimum(0) exposure_edit.setDecimals(1) exposure_edit.setSingleStep(0.1) exposure_edit.setValue(self.dlp_controller.features_exposure) exposure_edit.valueChanged.connect( self.dlp_controller.set_features_exposure_time) amplitude_label = QLabel("Light Amplitude", self.__features_widget) amplitude_edit = QSpinBox(self.__features_widget) amplitude_edit.setMaximum(1600) amplitude_edit.setMinimum(0) amplitude_edit.setSingleStep(1) amplitude_edit.setValue(self.dlp_controller.features_amplitude) amplitude_edit.valueChanged.connect( self.dlp_controller.set_features_amplitude) burn_layers_label = QLabel("Burn Layers", self.__features_widget) burn_layers_edit = QSpinBox(self.__features_widget) burn_layers_edit.setMaximum(1000) burn_layers_edit.setMinimum(0) burn_layers_edit.setSingleStep(1) burn_layers_edit.setValue(self.dlp_controller.features_burn_layers) burn_layers_edit.valueChanged.connect( self.dlp_controller.set_features_burning_layers) burn_exposure_label = QLabel("Burn Exposure", self.__features_widget) burn_exposure_edit = QDoubleSpinBox(self.__features_widget) burn_exposure_edit.setSuffix(str('ms')) burn_exposure_edit.setMaximum(100000) burn_exposure_edit.setMinimum(0) burn_exposure_edit.setDecimals(1) burn_exposure_edit.setSingleStep(0.1) burn_exposure_edit.setValue(self.dlp_controller.features_burn_exposure) burn_exposure_edit.valueChanged.connect( self.dlp_controller.set_features_burning_exposure_time) burn_amplitude_label = QLabel("Burn Amplitude", self.__features_widget) burn_amplitude_edit = QSpinBox(self.__features_widget) burn_amplitude_edit.setMaximum(1600) burn_amplitude_edit.setMinimum(0) burn_amplitude_edit.setSingleStep(1) burn_amplitude_edit.setValue( self.dlp_controller.features_burn_amplitude) burn_amplitude_edit.valueChanged.connect( self.dlp_controller.set_features_burning_amplitude) select_layers_button = QPushButton("Select Features Images") select_layers_button.clicked.connect(self.load_features_images) features_layout = QGridLayout(self.__features_widget) features_layout.addWidget(thickness_label, 1, 0) features_layout.addWidget(self.features_thickness_edit, 1, 1) features_layout.addWidget(exposure_label, 2, 0) features_layout.addWidget(exposure_edit, 2, 1) features_layout.addWidget(amplitude_label, 3, 0) features_layout.addWidget(amplitude_edit, 3, 1) features_layout.addWidget(burn_layers_label, 4, 0) features_layout.addWidget(burn_layers_edit, 4, 1) features_layout.addWidget(burn_exposure_label, 5, 0) features_layout.addWidget(burn_exposure_edit, 5, 1) features_layout.addWidget(burn_amplitude_label, 6, 0) features_layout.addWidget(burn_amplitude_edit, 6, 1) features_layout.addWidget(select_layers_button, 7, 0, 1, 2) self.__features_widget.setLayout(features_layout) def __init_advanced_features_widget__(self, parent=None): self.__advanced_widget = QGroupBox("Advanced Features Options", parent) fixed_layer_check = QCheckBox("Fixed Layer", self.__advanced_widget) fixed_layer_check.setChecked(self.dlp_controller.fixed_layer) fixed_layer_check.toggled.connect(self.dlp_controller.set_fixed_layer) incremental_amplitude_check = QCheckBox("Incremental Amplitude", self.__advanced_widget) incremental_amplitude_check.setChecked( self.dlp_controller.incremental_amplitude) incremental_amplitude_check.toggled.connect( self.dlp_controller.set_incremental_amplitude) starting_amplitude_label = QLabel("Starting Amplitude", self.__advanced_widget) starting_amplitude_edit = QSpinBox(self.__advanced_widget) starting_amplitude_edit.setMaximum(1000) starting_amplitude_edit.setMinimum(0) starting_amplitude_edit.setSingleStep(1) starting_amplitude_edit.setValue( self.dlp_controller.starting_incremental_amplitude) starting_amplitude_edit.valueChanged.connect( self.dlp_controller.set_starting_incremental_amplitude) amplitude_step_label = QLabel("Step Size", self.__advanced_widget) amplitude_step_edit = QSpinBox(self.__advanced_widget) amplitude_step_edit.setMaximum(1000) amplitude_step_edit.setMinimum(0) amplitude_step_edit.setSingleStep(1) amplitude_step_edit.setValue( self.dlp_controller.incremental_step_amplitude) amplitude_step_edit.valueChanged.connect( self.dlp_controller.set_incremental_step_amplitude) incremental_exposure_check = QCheckBox("Incremental Exposure", self.__advanced_widget) incremental_exposure_check.setChecked( self.dlp_controller.incremental_exposure) incremental_exposure_check.toggled.connect( self.dlp_controller.set_incremental_exposure) starting_exposure_label = QLabel("Starting Exposure", self.__advanced_widget) starting_exposure_edit = QDoubleSpinBox(self.__advanced_widget) starting_exposure_edit.setSuffix(str('ms')) starting_exposure_edit.setMaximum(100000) starting_exposure_edit.setMinimum(0) starting_exposure_edit.setDecimals(1) starting_exposure_edit.setSingleStep(0.1) starting_exposure_edit.valueChanged.connect( self.dlp_controller.set_starting_incremental_exposure) starting_exposure_edit.setValue( self.dlp_controller.starting_incremental_exposure) exposure_step_label = QLabel("Step Size", self.__advanced_widget) exposure_step_edit = QDoubleSpinBox(self.__advanced_widget) exposure_step_edit.setSuffix(str('ms')) exposure_step_edit.setMaximum(100000) exposure_step_edit.setMinimum(0) exposure_step_edit.setDecimals(1) exposure_step_edit.setSingleStep(0.1) exposure_step_edit.valueChanged.connect( self.dlp_controller.set_incremental_step_exposure) exposure_step_edit.setValue( self.dlp_controller.incremental_step_exposure) incremental_thickness_check = QCheckBox("Incremental Thickness", self.__advanced_widget) incremental_thickness_check.setChecked( self.dlp_controller.incremental_thickness) incremental_thickness_check.toggled.connect( self.dlp_controller.set_incremental_thickness) thickness_label = QLabel("Starting Thickness", self.__features_widget) self.starting_thickness_edit = MyDiscreteStepsSpinBox( self.dlp_controller.get_step_length_microns(), self.__features_widget) self.starting_thickness_edit.setSuffix(str('\u03BCm')) self.starting_thickness_edit.setMaximum(1000000) self.starting_thickness_edit.setMinimum(0) self.starting_thickness_edit.setDecimals(3) self.starting_thickness_edit.my_value_changed_signal.connect( self.dlp_controller.set_starting_incremental_thickness) self.starting_thickness_edit.setValue( self.dlp_controller.starting_incremental_thickness * 1000) thickness_step_label = QLabel("Step Size", self.__features_widget) self.thickness_step_edit = MyDiscreteStepsSpinBox( self.dlp_controller.get_step_length_microns(), self.__features_widget) self.thickness_step_edit.setSuffix(str('\u03BCm')) self.thickness_step_edit.setMaximum(1000000) self.thickness_step_edit.setMinimum(0) self.thickness_step_edit.setDecimals(3) self.thickness_step_edit.my_value_changed_signal.connect( self.dlp_controller.set_incremental_step_thickness) self.thickness_step_edit.setValue( self.dlp_controller.incremental_step_thickness * 1000) apply_grayscale_correction_check = QCheckBox("Grayscale Correction", self.__advanced_widget) apply_grayscale_correction_check.setChecked( self.dlp_controller.grayscale_correction) apply_grayscale_correction_check.toggled.connect( self.dlp_controller.set_grayscale_correction) grayscale_parameters_widget = QWidget(self.__features_widget) a_parameter_label = QLabel("\u03B1", grayscale_parameters_widget) alpha_parameter_edit = QDoubleSpinBox(grayscale_parameters_widget) alpha_parameter_edit.setMaximum(1000) alpha_parameter_edit.setMinimum(0) alpha_parameter_edit.setDecimals(3) alpha_parameter_edit.setSingleStep(0.001) alpha_parameter_edit.valueChanged.connect( self.dlp_controller.set_grayscale_alpha) alpha_parameter_edit.setValue(self.dlp_controller.grayscale_alpha) beta_parameter_label = QLabel("\u03B2", grayscale_parameters_widget) beta_parameter_edit = QDoubleSpinBox(grayscale_parameters_widget) beta_parameter_edit.setMaximum(1000) beta_parameter_edit.setMinimum(0) beta_parameter_edit.setDecimals(3) beta_parameter_edit.setSingleStep(0.001) beta_parameter_edit.valueChanged.connect( self.dlp_controller.set_grayscale_beta) beta_parameter_edit.setValue(self.dlp_controller.grayscale_beta) gamma_parameter_label = QLabel("\u03B3", grayscale_parameters_widget) gamma_parameter_edit = QDoubleSpinBox(grayscale_parameters_widget) gamma_parameter_edit.setMaximum(1000) gamma_parameter_edit.setMinimum(0) gamma_parameter_edit.setDecimals(3) gamma_parameter_edit.setSingleStep(0.001) gamma_parameter_edit.valueChanged.connect( self.dlp_controller.set_grayscale_gamma) gamma_parameter_edit.setValue(self.dlp_controller.grayscale_gamma) grayscale_parameters_layout = QHBoxLayout(grayscale_parameters_widget) grayscale_parameters_layout.addWidget(a_parameter_label) grayscale_parameters_layout.addWidget(alpha_parameter_edit) grayscale_parameters_layout.addWidget(beta_parameter_label) grayscale_parameters_layout.addWidget(beta_parameter_edit) grayscale_parameters_layout.addWidget(gamma_parameter_label) grayscale_parameters_layout.addWidget(gamma_parameter_edit) grayscale_parameters_widget.setLayout(grayscale_parameters_layout) advanced_features_layout = QGridLayout(self.__advanced_widget) advanced_features_layout.addWidget(incremental_amplitude_check, 1, 0, 1, 2) advanced_features_layout.addWidget(fixed_layer_check, 1, 3) advanced_features_layout.addWidget(starting_amplitude_label, 2, 0) advanced_features_layout.addWidget(starting_amplitude_edit, 2, 1) advanced_features_layout.addWidget(amplitude_step_label, 2, 2) advanced_features_layout.addWidget(amplitude_step_edit, 2, 3) advanced_features_layout.addWidget(incremental_exposure_check, 3, 0, 1, 2) advanced_features_layout.addWidget(starting_exposure_label, 4, 0) advanced_features_layout.addWidget(starting_exposure_edit, 4, 1) advanced_features_layout.addWidget(exposure_step_label, 4, 2) advanced_features_layout.addWidget(exposure_step_edit, 4, 3) advanced_features_layout.addWidget(incremental_thickness_check, 5, 0, 1, 2) advanced_features_layout.addWidget(thickness_label, 6, 0) advanced_features_layout.addWidget(self.starting_thickness_edit, 6, 1) advanced_features_layout.addWidget(thickness_step_label, 6, 2) advanced_features_layout.addWidget(self.thickness_step_edit, 6, 3) advanced_features_layout.addWidget(apply_grayscale_correction_check, 7, 0, 1, 2) advanced_features_layout.addWidget(grayscale_parameters_widget, 8, 0, 1, 4) self.__advanced_widget.setLayout(advanced_features_layout) def __init_start_stop_widget__(self, parent=None): self.__start_stop_widget = QFrame(parent) size = self.__left_layout.sizeHint() start_button = QPushButton("START", self.__start_stop_widget) start_button.setFixedSize(size.width() / 2, size.height() / 7) start_button.clicked.connect( self.dlp_controller.starting_printing_process) stop_button = QPushButton("STOP", self.__start_stop_widget) stop_button.setFixedSize(size.width() / 3, size.height() / 8) stop_button.setStyleSheet( "QPushButton {background-color: red; border-style: outset; border-width: 2px; " "border-radius: 10px; border-color: beige; font: bold 20px; padding: 10px;}" ) stop_button.clicked.connect(self.dlp_controller.stop_printing_process) self.__start_stop_widget.setMinimumSize(size.width(), size.height() / 6) start_stop_layout = QGridLayout(self.__start_stop_widget) start_stop_layout.addWidget(start_button, 0, 0) start_stop_layout.addWidget(stop_button, 0, 1) self.__start_stop_widget.setLayout(start_stop_layout) def __init_preview_widget__(self, parent=None): self.__preview_widget = QLabel(parent) size = self.__left_layout.sizeHint() self.dlp_controller.display_image_signal.connect(self.preview_image) self.__preview_widget.setMinimumSize(size.width(), size.height() / 2.3) # self.__preview_widget.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.__preview_widget.setScaledContents(True) self.__preview_widget.setStyleSheet( "QLabel { background-color : black}") def __init_console_widget__(self, parent=None): self.__console_widget = QPlainTextEdit(parent) self.__console_widget.setReadOnly(True) size = self.__left_layout.sizeHint() # self.__console_widget.setFixedSize(size.width(), size.height()/3) self.__console_widget.setStyleSheet( "QPlainTextEdit { background-color : gray}") palette = self.__console_widget.palette() palette.setColor(QPalette.Text, QColor(255, 255, 255)) self.__console_widget.setPalette(palette) self.dlp_controller.print_text_signal.connect(self.print_to_console) def __init_username_jobname_widget__(self, parent=None): self.__username_jobname_widget = QFrame(parent) self.__username_jobname_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) username_label = QLabel("Username", parent=self.__username_jobname_widget) username_edit = QLineEdit(parent=self.__username_jobname_widget) username_edit.setText(self.dlp_controller.username) username_edit.textChanged.connect(self.dlp_controller.set_username) jobname_label = QLabel("Print Job Name", parent=self.__username_jobname_widget) jobname_edit = QLineEdit(parent=self.__username_jobname_widget) jobname_edit.setText(self.dlp_controller.print_job_name) jobname_edit.textChanged.connect(self.dlp_controller.set_printjob_name) etc = self.dlp_controller.evaluate_time_estimate() self.etc_label = QLabel( "ETC: " + QDateTime.fromTime_t(etc / 1000.0).toUTC().toString('hh:mm:ss'), self.__username_jobname_widget) self.dlp_controller.etc_updated_signal.connect( self.update_time_estimate) username_jobname_layout = QHBoxLayout(self.__username_jobname_widget) username_jobname_layout.addWidget(self.etc_label) username_jobname_layout.addWidget(username_label) username_jobname_layout.addWidget(username_edit) username_jobname_layout.addWidget(jobname_label) username_jobname_layout.addWidget(jobname_edit) self.__username_jobname_widget.setLayout(username_jobname_layout) @Slot(QPixmap) def preview_image(self, image): image = image.scaled(self.__preview_widget.width(), self.__preview_widget.height(), Qt.IgnoreAspectRatio) self.__preview_widget.setPixmap(image) @Slot(str) def print_to_console(self, txt): self.__console_widget.appendPlainText(txt) @Slot() def closeEvent(self, event: QCloseEvent): self.closing_window_event.emit() event.accept() @Slot() def load_support_images(self): file_names = QFileDialog.getOpenFileNames( caption='Select images', dir='../', filter="Image Files (*.png *.jpg *.bmp)") self.dlp_controller.set_support_images(file_names[0]) @Slot() def load_features_images(self): file_names = QFileDialog.getOpenFileNames( caption='Select images', dir='../', filter="Image Files (*.png *.jpg *.bmp)") self.dlp_controller.set_features_images(file_names[0]) @Slot() def block_parameters_signals(self): for widget in self.__left_widget.findChildren(QWidget): widget.blockSignals(True) @Slot() def reactivate_parameters_signals(self): for widget in self.__left_widget.findChildren(QWidget): widget.blockSignals(False) @Slot() def update_time_estimate(self, etc_ms): self.etc_label.setText( "ETC: " + QDateTime.fromTime_t(etc_ms / 1000.0).toUTC().toString('hh:mm:ss')) @Slot() def update_port_list(self): self.dlp_controller.update_port_list() self.port_list.clear() self.port_list.addItems(self.dlp_controller.available_ports()) @Slot(bool) def update_motor_parameters(self, is_changed): self.move_edit.set_step_size( self.dlp_controller.get_step_length_microns() / 1000.0) self.support_thickness_edit.set_step_size( self.dlp_controller.get_step_length_microns()) self.support_thickness_edit.spinbox_is_value_valid( self.dlp_controller.support_thickness * 1000) self.features_thickness_edit.set_step_size( self.dlp_controller.get_step_length_microns()) self.features_thickness_edit.spinbox_is_value_valid( self.dlp_controller.features_thickness * 1000) self.starting_thickness_edit.set_step_size( self.dlp_controller.get_step_length_microns()) self.starting_thickness_edit.spinbox_is_value_valid( self.dlp_controller.starting_incremental_thickness * 1000) self.thickness_step_edit.set_step_size( self.dlp_controller.get_step_length_microns()) self.thickness_step_edit.spinbox_is_value_valid( self.dlp_controller.incremental_step_thickness * 1000)
class UiMainWindow(object): '''Интерфейс основного окна программы. Created by: Qt User Interface Compiler. Задано: панель инструментов с кнопками "Новый расчёт" (очистка всех полей), выбор режима расчёта, запуск расчёта; четыре поля ввода (длина заготовки, длина безусловного отхода, ширина реза, длина первичной обрезки торца заготовки) таблица ввода длин элементов и их количеств; кнопки "добавить строку в конец таблицы" и "удалить последнюю строку в таблице"; поле вывода результата расчёта. ''' def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(700, 495) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.main_frame = QFrame(self.centralwidget) self.main_frame.setObjectName(u"main_frame") self.main_frame.setFrameShape(QFrame.StyledPanel) self.main_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_2 = QVBoxLayout(self.main_frame) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) # "панель инструментов" self.top_frame = QFrame(self.main_frame) self.top_frame.setObjectName(u"top_frame") self.top_frame.setMinimumSize(QSize(0, 60)) self.top_frame.setMaximumSize(QSize(16777215, 60)) self.top_frame.setFrameShape(QFrame.StyledPanel) self.top_frame.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self.top_frame) self.horizontalLayout.setSpacing(5) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(5, 5, 5, 5) # кнопка "новый расчёт" self.new_calc_btn = QPushButton(self.top_frame) self.new_calc_btn.setObjectName(u"new_calc_btn") self.new_calc_btn.setMinimumSize(QSize(110, 50)) self.new_calc_btn.setMaximumSize(QSize(110, 50)) icon = QIcon() icon.addFile(NEW_CALC_ICON, QSize(), QIcon.Normal, QIcon.Off) self.new_calc_btn.setIcon(icon) self.new_calc_btn.setIconSize(QSize(45, 45)) self.horizontalLayout.addWidget(self.new_calc_btn) # кнопка "выбор режима расчёта" self.select_mode_btn = QPushButton(self.top_frame) self.select_mode_btn.setObjectName(u"select_mode_btn") self.select_mode_btn.setMinimumSize(QSize(110, 50)) self.select_mode_btn.setMaximumSize(QSize(110, 50)) icon1 = QIcon() icon1.addFile(SET_MODE_ICON, QSize(), QIcon.Normal, QIcon.Off) self.select_mode_btn.setIcon(icon1) self.select_mode_btn.setIconSize(QSize(45, 45)) self.horizontalLayout.addWidget(self.select_mode_btn) # кнопка "запуск расчёта" self.start_calc_btn = QPushButton(self.top_frame) self.start_calc_btn.setObjectName(u"start_calc_btn") self.start_calc_btn.setMinimumSize(QSize(110, 50)) self.start_calc_btn.setMaximumSize(QSize(110, 50)) icon2 = QIcon() icon2.addFile(START_CALC_ICON, QSize(), QIcon.Normal, QIcon.Off) self.start_calc_btn.setIcon(icon2) self.start_calc_btn.setIconSize(QSize(45, 45)) self.horizontalLayout.addWidget(self.start_calc_btn) self.horizontalSpacer = QSpacerItem(338, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer) self.verticalLayout_2.addWidget(self.top_frame) self.bottom_frame = QFrame(self.main_frame) self.bottom_frame.setObjectName(u"bottom_frame") self.bottom_frame.setFrameShape(QFrame.StyledPanel) self.bottom_frame.setFrameShadow(QFrame.Raised) self.horizontalLayout_2 = QHBoxLayout(self.bottom_frame) self.horizontalLayout_2.setSpacing(5) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(5, 5, 5, 5) self.input_frame = QFrame(self.bottom_frame) self.input_frame.setObjectName(u"input_frame") self.input_frame.setMinimumSize(QSize(340, 0)) self.input_frame.setMaximumSize(QSize(340, 16777215)) self.input_frame.setFrameShape(QFrame.StyledPanel) self.input_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_3 = QVBoxLayout(self.input_frame) self.verticalLayout_3.setSpacing(5) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) # поле ввода длины заготовки self.length_layout = QHBoxLayout() self.length_layout.setSpacing(5) self.length_layout.setObjectName(u"length_layout") self.length_label = QLabel(self.input_frame) self.length_label.setObjectName(u"length_label") self.length_label.setMinimumSize(QSize(165, 25)) self.length_label.setMaximumSize(QSize(165, 25)) self.length_layout.addWidget(self.length_label) self.length_entry = QLineEdit(self.input_frame) self.length_entry.setObjectName(u"length_entry") self.length_entry.setMinimumSize(QSize(165, 25)) self.length_entry.setMaximumSize(QSize(165, 25)) self.length_layout.addWidget(self.length_entry) self.verticalLayout_3.addLayout(self.length_layout) # поле ввода длины безусловного отхода self.waste_layout = QHBoxLayout() self.waste_layout.setSpacing(5) self.waste_layout.setObjectName(u"waste_layout") self.waste_label = QLabel(self.input_frame) self.waste_label.setObjectName(u"waste_label") self.waste_label.setMinimumSize(QSize(165, 25)) self.waste_label.setMaximumSize(QSize(165, 25)) self.waste_layout.addWidget(self.waste_label) self.waste_entry = QLineEdit(self.input_frame) self.waste_entry.setObjectName(u"waste_entry") self.waste_entry.setMinimumSize(QSize(165, 25)) self.waste_entry.setMaximumSize(QSize(165, 25)) self.waste_layout.addWidget(self.waste_entry) self.verticalLayout_3.addLayout(self.waste_layout) # поле ввода ширины реза self.cut_layout = QHBoxLayout() self.cut_layout.setSpacing(5) self.cut_layout.setObjectName(u"cut_layout") self.cut_label = QLabel(self.input_frame) self.cut_label.setObjectName(u"cut_label") self.cut_label.setMinimumSize(QSize(165, 25)) self.cut_label.setMaximumSize(QSize(165, 25)) self.cut_layout.addWidget(self.cut_label) self.cut_entry = QLineEdit(self.input_frame) self.cut_entry.setObjectName(u"cut_entry") self.cut_entry.setMinimumSize(QSize(165, 25)) self.cut_entry.setMaximumSize(QSize(165, 25)) self.cut_layout.addWidget(self.cut_entry) self.verticalLayout_3.addLayout(self.cut_layout) # поле ввода длины подрезки торца заготовки self.trim_layout = QHBoxLayout() self.trim_layout.setSpacing(5) self.trim_layout.setObjectName(u"trim_layout") self.trim_label = QLabel(self.input_frame) self.trim_label.setObjectName(u"trim_label") self.trim_label.setMinimumSize(QSize(165, 25)) self.trim_label.setMaximumSize(QSize(165, 25)) self.trim_layout.addWidget(self.trim_label) self.trim_entry = QLineEdit(self.input_frame) self.trim_entry.setObjectName(u"trim_entry") self.trim_entry.setMinimumSize(QSize(165, 25)) self.trim_entry.setMaximumSize(QSize(165, 25)) self.trim_layout.addWidget(self.trim_entry) self.verticalLayout_3.addLayout(self.trim_layout) # таблица ввода длин и количеств элементов self.input_table = QTableWidget(self.input_frame) if (self.input_table.columnCount() < 2): self.input_table.setColumnCount(2) if (self.input_table.rowCount() < 7): self.input_table.setRowCount(7) self.input_table.setObjectName(u"input_table") self.input_table.setRowCount(7) self.input_table.setColumnCount(2) self.input_table.horizontalHeader().setMinimumSectionSize(33) self.input_table.horizontalHeader().setDefaultSectionSize(130) self.input_table.horizontalHeader().setProperty( "showSortIndicator", True, ) self.input_table.horizontalHeader().setStretchLastSection(True) self.input_table.verticalHeader().setMinimumSectionSize(30) self.input_table.verticalHeader().setDefaultSectionSize(30) self.verticalLayout_3.addWidget(self.input_table) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") # кнопка "добавить строку в конец таблицы" self.add_str_button = QPushButton(self.input_frame) self.add_str_button.setObjectName(u"add_str_button") self.add_str_button.setMinimumSize(QSize(150, 35)) self.add_str_button.setMaximumSize(QSize(150, 35)) icon3 = QIcon() icon3.addFile( ADD_STR_ICON, QSize(), QIcon.Normal, QIcon.Off, ) self.add_str_button.setIcon(icon3) self.add_str_button.setIconSize(QSize(25, 25)) self.horizontalLayout_3.addWidget(self.add_str_button) # кнопка "удалить последнюю строку в таблице" self.remove_str_button = QPushButton(self.input_frame) self.remove_str_button.setObjectName(u"remove_str_button") self.remove_str_button.setMinimumSize(QSize(150, 35)) self.remove_str_button.setMaximumSize(QSize(150, 35)) icon4 = QIcon() icon4.addFile( DESTR_STR_ICON, QSize(), QIcon.Normal, QIcon.Off, ) self.remove_str_button.setIcon(icon4) self.remove_str_button.setIconSize(QSize(25, 25)) self.horizontalLayout_3.addWidget(self.remove_str_button) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.horizontalLayout_2.addWidget(self.input_frame) self.output_frame = QFrame(self.bottom_frame) self.output_frame.setObjectName(u"output_frame") self.output_frame.setFrameShape(QFrame.StyledPanel) self.output_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_4 = QVBoxLayout(self.output_frame) self.verticalLayout_4.setObjectName(u"verticalLayout_4") # поле вывода результатов расчёта self.textBrowser = QTextBrowser(self.output_frame) self.textBrowser.setObjectName(u"textBrowser") self.verticalLayout_4.addWidget(self.textBrowser) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") # строка состояния self.label_2 = QLabel(self.output_frame) self.label_2.setObjectName(u"label_2") self.label_2.setMinimumSize(QSize(25, 25)) self.label_2.setMaximumSize(QSize(16777215, 25)) self.horizontalLayout_4.addWidget(self.label_2) self.horizontalSpacer_2 = QSpacerItem( 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum, ) self.horizontalLayout_4.addItem(self.horizontalSpacer_2) # поле вывода версии программы self.label = QLabel(self.output_frame) self.label.setObjectName(u"label") self.label.setMinimumSize(QSize(0, 25)) self.label.setMaximumSize(QSize(16777215, 25)) self.horizontalLayout_4.addWidget(self.label) self.verticalLayout_4.addLayout(self.horizontalLayout_4) self.horizontalLayout_2.addWidget(self.output_frame) self.verticalLayout_2.addWidget(self.bottom_frame) self.verticalLayout.addWidget(self.main_frame) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"simple linear nesting", None)) # if QT_CONFIG(tooltip) self.new_calc_btn.setToolTip( QCoreApplication.translate("MainWindow", u"Clear all fields, Ctrl+N", None)) # endif // QT_CONFIG(tooltip) self.new_calc_btn.setText( QCoreApplication.translate("MainWindow", u"new", None)) # if QT_CONFIG(shortcut) self.new_calc_btn.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl+N", None)) # endif // QT_CONFIG(shortcut) # if QT_CONFIG(tooltip) self.select_mode_btn.setToolTip( QCoreApplication.translate("MainWindow", u"Select calculation mode, Ctrl+M", None)) # endif // QT_CONFIG(tooltip) self.select_mode_btn.setText( QCoreApplication.translate("MainWindow", u"mode", None)) # if QT_CONFIG(shortcut) self.select_mode_btn.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl+M", None)) # endif // QT_CONFIG(shortcut) # if QT_CONFIG(tooltip) self.start_calc_btn.setToolTip( QCoreApplication.translate("MainWindow", u"Start calculation, Ctrl+R", None)) # endif // QT_CONFIG(tooltip) self.start_calc_btn.setText( QCoreApplication.translate("MainWindow", u"start", None)) # if QT_CONFIG(shortcut) self.start_calc_btn.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl+R", None)) # endif // QT_CONFIG(shortcut) self.length_label.setText( QCoreApplication.translate("MainWindow", u"workpiece length", None)) # if QT_CONFIG(tooltip) self.length_entry.setToolTip( QCoreApplication.translate("MainWindow", u"Enter the length of the workpiece", None)) # endif // QT_CONFIG(tooltip) self.waste_label.setText( QCoreApplication.translate("MainWindow", u"irreducible waste", None)) # if QT_CONFIG(tooltip) self.waste_entry.setToolTip( QCoreApplication.translate("MainWindow", u"Enter the length of the waste", None)) # endif // QT_CONFIG(tooltip) self.cut_label.setText( QCoreApplication.translate("MainWindow", u"cutting width", None)) # if QT_CONFIG(tooltip) self.cut_entry.setToolTip( QCoreApplication.translate("MainWindow", u"Enter the width of the cutting", None)) # endif // QT_CONFIG(tooltip) self.trim_label.setText( QCoreApplication.translate("MainWindow", u"trim the end", None)) # if QT_CONFIG(tooltip) self.trim_entry.setToolTip( QCoreApplication.translate( "MainWindow", u"Enter the length of the trimming end", None)) # endif // QT_CONFIG(tooltip) # if QT_CONFIG(tooltip) self.add_str_button.setToolTip( QCoreApplication.translate( "MainWindow", u"Add another row to the table, Ctrl++", None)) # endif // QT_CONFIG(tooltip) self.add_str_button.setText("") # if QT_CONFIG(shortcut) self.add_str_button.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl++", None)) # endif // QT_CONFIG(shortcut) # if QT_CONFIG(tooltip) self.remove_str_button.setToolTip( QCoreApplication.translate( "MainWindow", u"Delete the last row in the table, Ctrl+-", None)) # endif // QT_CONFIG(tooltip) self.remove_str_button.setText("") # if QT_CONFIG(shortcut) self.remove_str_button.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl+-", None)) # endif // QT_CONFIG(shortcut) self.label_2.setText("") self.label.setText( QCoreApplication.translate("MainWindow", u"v.0.0.0", None))
class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(450, 235) Dialog.setMinimumSize(QSize(450, 235)) Dialog.setMaximumSize(QSize(450, 235)) Dialog.setStyleSheet(u"QDialog {\n" " background:rgb(51,51,51);\n" "}") self.verticalLayout = QVBoxLayout(Dialog) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.frame_2 = QFrame(Dialog) self.frame_2.setObjectName(u"frame_2") self.frame_2.setStyleSheet(u"background:rgb(51,51,51);") self.frame_2.setFrameShape(QFrame.NoFrame) self.frame_2.setFrameShadow(QFrame.Plain) self.verticalLayout_2 = QVBoxLayout(self.frame_2) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(2, 2, 2, 2) self.frame_top = QFrame(self.frame_2) self.frame_top.setObjectName(u"frame_top") self.frame_top.setMinimumSize(QSize(0, 55)) self.frame_top.setMaximumSize(QSize(16777215, 55)) self.frame_top.setStyleSheet(u"background:rgb(91,90,90);") self.frame_top.setFrameShape(QFrame.NoFrame) self.frame_top.setFrameShadow(QFrame.Plain) self.horizontalLayout = QHBoxLayout(self.frame_top) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.lab_heading = QLabel(self.frame_top) self.lab_heading.setObjectName(u"lab_heading") font = QFont() font.setFamily(u"Segoe UI") font.setPointSize(14) self.lab_heading.setFont(font) self.lab_heading.setStyleSheet(u"color:rgb(255,255,255);") self.lab_heading.setAlignment(Qt.AlignCenter) self.horizontalLayout.addWidget(self.lab_heading) self.bn_min = QPushButton(self.frame_top) self.bn_min.setObjectName(u"bn_min") self.bn_min.setMinimumSize(QSize(55, 55)) self.bn_min.setMaximumSize(QSize(55, 55)) self.bn_min.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgb(51,51,51);\n" "}") icon = QIcon() icon.addFile(u"icons/1x/hideAsset 53.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_min.setIcon(icon) self.bn_min.setIconSize(QSize(22, 12)) self.bn_min.setAutoDefault(False) self.bn_min.setFlat(True) self.horizontalLayout.addWidget(self.bn_min) self.bn_close = QPushButton(self.frame_top) self.bn_close.setObjectName(u"bn_close") self.bn_close.setMinimumSize(QSize(55, 55)) self.bn_close.setMaximumSize(QSize(55, 55)) self.bn_close.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgb(51,51,51);\n" "}") icon1 = QIcon() icon1.addFile(u"icons/1x/closeAsset 43.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_close.setIcon(icon1) self.bn_close.setIconSize(QSize(22, 22)) self.bn_close.setAutoDefault(False) self.bn_close.setFlat(True) self.horizontalLayout.addWidget(self.bn_close) self.verticalLayout_2.addWidget(self.frame_top) self.frame_bottom = QFrame(self.frame_2) self.frame_bottom.setObjectName(u"frame_bottom") self.frame_bottom.setStyleSheet(u"background:rgb(91,90,90);") self.frame_bottom.setFrameShape(QFrame.StyledPanel) self.frame_bottom.setFrameShadow(QFrame.Raised) self.gridLayout = QGridLayout(self.frame_bottom) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setHorizontalSpacing(5) self.gridLayout.setVerticalSpacing(0) self.gridLayout.setContentsMargins(15, -1, 35, 0) self.bn_east = QPushButton(self.frame_bottom) self.bn_east.setObjectName(u"bn_east") self.bn_east.setMinimumSize(QSize(69, 25)) self.bn_east.setMaximumSize(QSize(69, 25)) font1 = QFont() font1.setFamily(u"Segoe UI") font1.setPointSize(12) self.bn_east.setFont(font1) self.bn_east.setStyleSheet(u"QPushButton {\n" " border: 2px solid rgb(51,51,51);\n" " border-radius: 5px; \n" " color:rgb(255,255,255);\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(51,51,51);\n" "}") self.bn_east.setAutoDefault(False) self.gridLayout.addWidget(self.bn_east, 1, 3, 1, 1) self.lab_icon = QLabel(self.frame_bottom) self.lab_icon.setObjectName(u"lab_icon") self.lab_icon.setMinimumSize(QSize(40, 40)) self.lab_icon.setMaximumSize(QSize(40, 40)) self.gridLayout.addWidget(self.lab_icon, 0, 0, 1, 1) self.bn_west = QPushButton(self.frame_bottom) self.bn_west.setObjectName(u"bn_west") self.bn_west.setMinimumSize(QSize(69, 25)) self.bn_west.setMaximumSize(QSize(69, 25)) self.bn_west.setFont(font1) self.bn_west.setStyleSheet(u"QPushButton {\n" " border: 2px solid rgb(51,51,51);\n" " border-radius: 5px; \n" " color:rgb(255,255,255);\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(51,51,51);\n" "}") self.bn_west.setAutoDefault(False) self.gridLayout.addWidget(self.bn_west, 1, 2, 1, 1) self.lab_message = QLabel(self.frame_bottom) self.lab_message.setObjectName(u"lab_message") self.lab_message.setFont(font1) self.lab_message.setStyleSheet(u"color:rgb(255,255,255);") self.lab_message.setWordWrap(True) self.gridLayout.addWidget(self.lab_message, 0, 1, 1, 3) self.verticalLayout_2.addWidget(self.frame_bottom) self.verticalLayout.addWidget(self.frame_2) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Dialog", None)) self.lab_heading.setText("") self.bn_min.setText("") self.bn_close.setText("") self.bn_east.setText("") self.lab_icon.setText("") self.bn_west.setText("") self.lab_message.setText("")
class UiQuestion(object): '''Интерфейс диалогового окна программы. Created by: Qt User Interface Compiler. Задано: кнопка "подтвердить"; кнопка "отклонить". ''' def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(300, 200) Dialog.setMinimumSize(QSize(300, 200)) Dialog.setMaximumSize(QSize(300, 200)) self.verticalLayout = QVBoxLayout(Dialog) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.dialog_main_frame = QFrame(Dialog) self.dialog_main_frame.setObjectName(u"dialog_main_frame") self.dialog_main_frame.setFrameShape(QFrame.StyledPanel) self.dialog_main_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_2 = QVBoxLayout(self.dialog_main_frame) self.verticalLayout_2.setSpacing(5) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(5, 5, 5, 5) self.text_frame = QFrame(self.dialog_main_frame) self.text_frame.setObjectName(u"text_frame") self.text_frame.setFrameShape(QFrame.StyledPanel) self.text_frame.setFrameShadow(QFrame.Raised) self.verticalLayout_3 = QVBoxLayout(self.text_frame) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.question_label = QLabel(self.text_frame) self.question_label.setObjectName(u"question_label") self.question_label.setAlignment(Qt.AlignCenter) self.verticalLayout_3.addWidget(self.question_label) self.verticalLayout_2.addWidget(self.text_frame) self.buttons_frame = QFrame(self.dialog_main_frame) self.buttons_frame.setObjectName(u"buttons_frame") self.buttons_frame.setMinimumSize(QSize(0, 50)) self.buttons_frame.setMaximumSize(QSize(16777215, 50)) self.buttons_frame.setFrameShape(QFrame.StyledPanel) self.buttons_frame.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self.buttons_frame) self.horizontalLayout.setSpacing(5) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(5, 5, 5, 5) self.question_nok_btn = QPushButton(self.buttons_frame) self.question_nok_btn.setObjectName(u"question_nok_btn") self.question_nok_btn.setMinimumSize(QSize(0, 35)) self.question_nok_btn.setMaximumSize(QSize(16777215, 35)) icon = QIcon() icon.addFile(DISAGREE_ICON, QSize(), QIcon.Normal, QIcon.Off) self.question_nok_btn.setIcon(icon) self.question_nok_btn.setIconSize(QSize(25, 25)) self.horizontalLayout.addWidget(self.question_nok_btn) self.question_ok_btn = QPushButton(self.buttons_frame) self.question_ok_btn.setObjectName(u"question_ok_btn") self.question_ok_btn.setMinimumSize(QSize(0, 35)) self.question_ok_btn.setMaximumSize(QSize(16777215, 35)) icon1 = QIcon() icon1.addFile(AGREE_ICON, QSize(), QIcon.Normal, QIcon.Off) self.question_ok_btn.setIcon(icon1) self.question_ok_btn.setIconSize(QSize(25, 25)) self.horizontalLayout.addWidget(self.question_ok_btn) self.verticalLayout_2.addWidget(self.buttons_frame) self.verticalLayout.addWidget(self.dialog_main_frame) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"new calculation", None)) self.question_label.setText( QCoreApplication.translate("Dialog", u"Clear all fields?", None)) # if QT_CONFIG(tooltip) self.question_nok_btn.setToolTip( QCoreApplication.translate("Dialog", u"cancel", None)) # endif // QT_CONFIG(tooltip) self.question_nok_btn.setText("") # if QT_CONFIG(tooltip) self.question_ok_btn.setToolTip( QCoreApplication.translate("Dialog", u"continue", None)) # endif // QT_CONFIG(tooltip) self.question_ok_btn.setText("")
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(800, 550) MainWindow.setMinimumSize(QSize(800, 550)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.centralwidget.setStyleSheet(u"background:rgb(91,90,90);") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.frame_top = QFrame(self.centralwidget) self.frame_top.setObjectName(u"frame_top") self.frame_top.setMaximumSize(QSize(16777215, 55)) self.frame_top.setFrameShape(QFrame.NoFrame) self.frame_top.setFrameShadow(QFrame.Plain) self.horizontalLayout = QHBoxLayout(self.frame_top) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.frame_toodle = QFrame(self.frame_top) self.frame_toodle.setObjectName(u"frame_toodle") self.frame_toodle.setMinimumSize(QSize(80, 55)) self.frame_toodle.setMaximumSize(QSize(80, 55)) self.frame_toodle.setStyleSheet(u"background:rgb(0,143,150);") self.frame_toodle.setFrameShape(QFrame.NoFrame) self.frame_toodle.setFrameShadow(QFrame.Plain) self.horizontalLayout_3 = QHBoxLayout(self.frame_toodle) self.horizontalLayout_3.setSpacing(0) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) self.toodle = QPushButton(self.frame_toodle) self.toodle.setObjectName(u"toodle") self.toodle.setMinimumSize(QSize(80, 55)) self.toodle.setMaximumSize(QSize(80, 55)) self.toodle.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgba(0,0,0,0);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,178,178);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgba(0,0,0,0);\n" "}") icon = QIcon() icon.addFile(u"icons/1x/logo.png", QSize(), QIcon.Normal, QIcon.Off) self.toodle.setIcon(icon) self.toodle.setIconSize(QSize(22, 12)) self.toodle.setFlat(True) self.horizontalLayout_3.addWidget(self.toodle) self.horizontalLayout.addWidget(self.frame_toodle) self.frame_top_east = QFrame(self.frame_top) self.frame_top_east.setObjectName(u"frame_top_east") self.frame_top_east.setMaximumSize(QSize(16777215, 55)) self.frame_top_east.setStyleSheet(u"background:rgb(51,51,51);") self.frame_top_east.setFrameShape(QFrame.NoFrame) self.frame_top_east.setFrameShadow(QFrame.Plain) self.horizontalLayout_4 = QHBoxLayout(self.frame_top_east) self.horizontalLayout_4.setSpacing(0) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.frame_appname = QFrame(self.frame_top_east) self.frame_appname.setObjectName(u"frame_appname") self.frame_appname.setFrameShape(QFrame.NoFrame) self.frame_appname.setFrameShadow(QFrame.Plain) self.horizontalLayout_10 = QHBoxLayout(self.frame_appname) self.horizontalLayout_10.setSpacing(7) self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.horizontalLayout_10.setContentsMargins(0, 0, 0, 0) self.lab_appname = QLabel(self.frame_appname) self.lab_appname.setObjectName(u"lab_appname") font = QFont() font.setFamily(u"Segoe UI Light") font.setPointSize(24) self.lab_appname.setFont(font) self.lab_appname.setStyleSheet(u"color:rgb(255,255,255);") self.horizontalLayout_10.addWidget(self.lab_appname) self.horizontalLayout_4.addWidget(self.frame_appname) self.frame_min = QFrame(self.frame_top_east) self.frame_min.setObjectName(u"frame_min") self.frame_min.setMinimumSize(QSize(55, 55)) self.frame_min.setMaximumSize(QSize(55, 55)) self.frame_min.setFrameShape(QFrame.NoFrame) self.frame_min.setFrameShadow(QFrame.Plain) self.horizontalLayout_7 = QHBoxLayout(self.frame_min) self.horizontalLayout_7.setSpacing(0) self.horizontalLayout_7.setObjectName(u"horizontalLayout_7") self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0) self.bn_min = QPushButton(self.frame_min) self.bn_min.setObjectName(u"bn_min") self.bn_min.setMaximumSize(QSize(55, 55)) self.bn_min.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgba(0,0,0,0);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgba(0,0,0,0);\n" "}") icon1 = QIcon() icon1.addFile(u"icons/1x/hideAsset 53.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_min.setIcon(icon1) self.bn_min.setIconSize(QSize(22, 22)) self.bn_min.setFlat(True) self.horizontalLayout_7.addWidget(self.bn_min) self.horizontalLayout_4.addWidget(self.frame_min) self.frame_max = QFrame(self.frame_top_east) self.frame_max.setObjectName(u"frame_max") self.frame_max.setMinimumSize(QSize(55, 55)) self.frame_max.setMaximumSize(QSize(55, 55)) self.frame_max.setFrameShape(QFrame.NoFrame) self.frame_max.setFrameShadow(QFrame.Plain) self.horizontalLayout_6 = QHBoxLayout(self.frame_max) self.horizontalLayout_6.setSpacing(0) self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) self.bn_max = QPushButton(self.frame_max) self.bn_max.setObjectName(u"bn_max") self.bn_max.setMaximumSize(QSize(55, 55)) self.bn_max.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgba(0,0,0,0);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgba(0,0,0,0);\n" "}") icon2 = QIcon() icon2.addFile(u"icons/1x/max.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_max.setIcon(icon2) self.bn_max.setIconSize(QSize(22, 22)) self.bn_max.setFlat(True) self.horizontalLayout_6.addWidget(self.bn_max) self.horizontalLayout_4.addWidget(self.frame_max) self.frame_close = QFrame(self.frame_top_east) self.frame_close.setObjectName(u"frame_close") self.frame_close.setMinimumSize(QSize(55, 55)) self.frame_close.setMaximumSize(QSize(55, 55)) self.frame_close.setFrameShape(QFrame.NoFrame) self.frame_close.setFrameShadow(QFrame.Plain) self.horizontalLayout_5 = QHBoxLayout(self.frame_close) self.horizontalLayout_5.setSpacing(0) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) self.bn_close = QPushButton(self.frame_close) self.bn_close.setObjectName(u"bn_close") self.bn_close.setMaximumSize(QSize(55, 55)) self.bn_close.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgba(0,0,0,0);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgba(0,0,0,0);\n" "}") icon3 = QIcon() icon3.addFile(u"icons/1x/closeAsset 43.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_close.setIcon(icon3) self.bn_close.setIconSize(QSize(22, 22)) self.bn_close.setFlat(True) self.horizontalLayout_5.addWidget(self.bn_close) self.horizontalLayout_4.addWidget(self.frame_close) self.horizontalLayout.addWidget(self.frame_top_east) self.verticalLayout.addWidget(self.frame_top) self.frame_bottom = QFrame(self.centralwidget) self.frame_bottom.setObjectName(u"frame_bottom") self.frame_bottom.setFrameShape(QFrame.NoFrame) self.frame_bottom.setFrameShadow(QFrame.Plain) self.horizontalLayout_2 = QHBoxLayout(self.frame_bottom) self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.frame_bottom_west = QFrame(self.frame_bottom) self.frame_bottom_west.setObjectName(u"frame_bottom_west") self.frame_bottom_west.setMinimumSize(QSize(80, 0)) self.frame_bottom_west.setMaximumSize(QSize(80, 16777215)) self.frame_bottom_west.setStyleSheet(u"background:rgb(51,51,51);") self.frame_bottom_west.setFrameShape(QFrame.NoFrame) self.frame_bottom_west.setFrameShadow(QFrame.Plain) self.verticalLayout_3 = QVBoxLayout(self.frame_bottom_west) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.frame_home = QFrame(self.frame_bottom_west) self.frame_home.setObjectName(u"frame_home") self.frame_home.setMinimumSize(QSize(80, 55)) self.frame_home.setMaximumSize(QSize(160, 55)) self.frame_home.setFrameShape(QFrame.NoFrame) self.frame_home.setFrameShadow(QFrame.Plain) self.horizontalLayout_15 = QHBoxLayout(self.frame_home) self.horizontalLayout_15.setSpacing(0) self.horizontalLayout_15.setObjectName(u"horizontalLayout_15") self.horizontalLayout_15.setContentsMargins(0, 0, 0, 0) self.bn_home = QPushButton(self.frame_home) self.bn_home.setObjectName(u"bn_home") self.bn_home.setMinimumSize(QSize(80, 55)) self.bn_home.setMaximumSize(QSize(160, 55)) self.bn_home.setStyleSheet(u"QPushButton {\n" " border: none;\n" " background-color: rgba(0,0,0,0);\n" "}\n" "QPushButton:hover {\n" " background-color: rgb(91,90,90);\n" "}\n" "QPushButton:pressed { \n" " background-color: rgba(0,0,0,0);\n" "}") icon4 = QIcon() icon4.addFile(u"icons/1x/homeAsset 46.png", QSize(), QIcon.Normal, QIcon.Off) self.bn_home.setIcon(icon4) self.bn_home.setIconSize(QSize(22, 22)) self.bn_home.setFlat(True) self.horizontalLayout_15.addWidget(self.bn_home) self.verticalLayout_3.addWidget(self.frame_home) self.frame_8 = QFrame(self.frame_bottom_west) self.frame_8.setObjectName(u"frame_8") self.frame_8.setFrameShape(QFrame.NoFrame) self.frame_8.setFrameShadow(QFrame.Plain) self.verticalLayout_4 = QVBoxLayout(self.frame_8) self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.addWidget(self.frame_8) self.horizontalLayout_2.addWidget(self.frame_bottom_west) self.frame_bottom_east = QFrame(self.frame_bottom) self.frame_bottom_east.setObjectName(u"frame_bottom_east") self.frame_bottom_east.setFrameShape(QFrame.NoFrame) self.frame_bottom_east.setFrameShadow(QFrame.Plain) self.verticalLayout_2 = QVBoxLayout(self.frame_bottom_east) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.frame = QFrame(self.frame_bottom_east) self.frame.setObjectName(u"frame") self.frame.setFrameShape(QFrame.NoFrame) self.frame.setFrameShadow(QFrame.Plain) self.horizontalLayout_14 = QHBoxLayout(self.frame) self.horizontalLayout_14.setSpacing(0) self.horizontalLayout_14.setObjectName(u"horizontalLayout_14") self.horizontalLayout_14.setContentsMargins(0, 0, 0, 0) self.stackedWidget = QStackedWidget(self.frame) self.stackedWidget.setObjectName(u"stackedWidget") self.stackedWidget.setMinimumSize(QSize(0, 55)) self.stackedWidget.setStyleSheet(u"") self.page_home = QWidget() self.page_home.setObjectName(u"page_home") self.page_home.setStyleSheet(u"background:rgb(91,90,90);") self.horizontalLayout_19 = QHBoxLayout(self.page_home) self.horizontalLayout_19.setSpacing(0) self.horizontalLayout_19.setObjectName(u"horizontalLayout_19") self.horizontalLayout_19.setContentsMargins(0, 5, 0, 5) self.frame_home_main = QFrame(self.page_home) self.frame_home_main.setObjectName(u"frame_home_main") self.frame_home_main.setFrameShape(QFrame.NoFrame) self.frame_home_main.setFrameShadow(QFrame.Plain) self.verticalLayout_5 = QVBoxLayout(self.frame_home_main) self.verticalLayout_5.setSpacing(5) self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.verticalLayout_5.setContentsMargins(5, 5, 5, 5) font1 = QFont() font1.setFamily(u"Segoe UI Semilight") font1.setPointSize(10) self.lab_home_main_disc = QLabel(self.frame_home_main) self.lab_home_main_disc.setObjectName(u"lab_home_main_disc") font2 = QFont() font2.setFamily(u"Segoe UI") font2.setPointSize(10) self.lab_home_main_disc.setFont(font2) self.lab_home_main_disc.setStyleSheet(u"color:rgb(255,255,255);") self.lab_home_main_disc.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop) self.lab_home_main_disc.setWordWrap(True) self.lab_home_main_disc.setMargin(5) self.verticalLayout_5.addWidget(self.lab_home_main_disc) self.horizontalLayout_19.addWidget(self.frame_home_main) self.vert_divide = QFrame(self.page_home) self.vert_divide.setObjectName(u"vert_divide") self.vert_divide.setFrameShape(QFrame.VLine) self.vert_divide.setFrameShadow(QFrame.Sunken) self.horizontalLayout_19.addWidget(self.vert_divide) self.frame_home_stat = QFrame(self.page_home) self.frame_home_stat.setObjectName(u"frame_home_stat") self.frame_home_stat.setMinimumSize(QSize(220, 0)) self.frame_home_stat.setMaximumSize(QSize(220, 16777215)) self.frame_home_stat.setFrameShape(QFrame.NoFrame) self.frame_home_stat.setFrameShadow(QFrame.Plain) self.verticalLayout_6 = QVBoxLayout(self.frame_home_stat) self.verticalLayout_6.setSpacing(5) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(5, 5, 5, 5) self.bn_home_image = QPushButton(self.frame_home_stat) self.bn_home_image.setObjectName(u"bn_home_image") self.bn_home_image.setEnabled(True) self.bn_home_image.setMinimumSize(QSize(205, 25)) self.bn_home_image.setMaximumSize(QSize(205, 25)) self.bn_home_image.setFont(font1) self.bn_home_image.setStyleSheet(u"QPushButton {\n" " border: 2px solid rgb(51,51,51);\n" " border-radius: 5px; \n" " color:rgb(255,255,255);\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(51,51,51);\n" "}\n" "\n" "QPushButton:disabled { \n" " border-radius: 5px; \n" " border: 2px solid rgb(112,112,112);\n" " background-color: rgb(112,112,112);\n" "}") self.verticalLayout_6.addWidget(self.bn_home_image) self.bn_home_rec = QPushButton(self.frame_home_stat) self.bn_home_rec.setObjectName(u"bn_home_rec") self.bn_home_rec.setEnabled(True) self.bn_home_rec.setMinimumSize(QSize(205, 25)) self.bn_home_rec.setMaximumSize(QSize(205, 25)) self.bn_home_rec.setFont(font1) self.bn_home_rec.setStyleSheet(u"QPushButton {\n" " border: 2px solid rgb(51,51,51);\n" " border-radius: 5px; \n" " color:rgb(255,255,255);\n" " background-color: rgb(51,51,51);\n" "}\n" "QPushButton:hover {\n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(0,143,150);\n" "}\n" "QPushButton:pressed { \n" " border: 2px solid rgb(0,143,150);\n" " background-color: rgb(51,51,51);\n" "}\n" "\n" "QPushButton:disabled { \n" " border-radius: 5px; \n" " border: 2px solid rgb(112,112,112);\n" " background-color: rgb(112,112,112);\n" "}") self.verticalLayout_6.addWidget(self.bn_home_rec) self.horizontalLayout_19.addWidget(self.frame_home_stat) self.stackedWidget.addWidget(self.page_home) self.page_about_home = QWidget() self.page_about_home.setObjectName(u"page_about_home") self.page_about_home.setStyleSheet(u"background:rgb(91,90,90);") self.verticalLayout_13 = QVBoxLayout(self.page_about_home) self.verticalLayout_13.setSpacing(5) self.verticalLayout_13.setObjectName(u"verticalLayout_13") self.verticalLayout_13.setContentsMargins(5, 5, 5, 5) self.lab_about_home = QLabel(self.page_about_home) self.lab_about_home.setObjectName(u"lab_about_home") self.lab_about_home.setMinimumSize(QSize(0, 55)) self.lab_about_home.setMaximumSize(QSize(16777215, 55)) font3 = QFont() font3.setFamily(u"Segoe UI") font3.setPointSize(24) self.lab_about_home.setFont(font3) self.lab_about_home.setStyleSheet(u"color:rgb(255,255,255);") self.verticalLayout_13.addWidget(self.lab_about_home) self.frame_about_home = QFrame(self.page_about_home) self.frame_about_home.setObjectName(u"frame_about_home") self.frame_about_home.setFrameShape(QFrame.StyledPanel) self.frame_about_home.setFrameShadow(QFrame.Raised) self.horizontalLayout_28 = QHBoxLayout(self.frame_about_home) self.horizontalLayout_28.setSpacing(0) self.horizontalLayout_28.setObjectName(u"horizontalLayout_28") self.horizontalLayout_28.setContentsMargins(5, 5, 0, 5) self.text_about_home = QTextEdit(self.frame_about_home) self.text_about_home.setObjectName(u"text_about_home") self.text_about_home.setEnabled(True) self.text_about_home.setFont(font2) self.text_about_home.setStyleSheet(u"color:rgb(255,255,255);") self.text_about_home.setFrameShape(QFrame.NoFrame) self.text_about_home.setFrameShadow(QFrame.Plain) self.text_about_home.setReadOnly(True) self.text_about_home.setTextInteractionFlags(Qt.TextBrowserInteraction) self.horizontalLayout_28.addWidget(self.text_about_home) self.vsb_about_home = QScrollBar(self.frame_about_home) self.vsb_about_home.setObjectName(u"vsb_about_home") self.vsb_about_home.setStyleSheet(u"QScrollBar:vertical {\n" " background:rgb(51,51,51);\n" " width:20px;\n" " margin: 0px 0px 0px 0px;\n" "}\n" "QScrollBar::handle:vertical {\n" " background:rgb(0,143,170);\n" "}\n" "QScrollBar::add-page:vertical {\n" " background:rgb(51,51,51);\n" "}\n" "QScrollBar::sub-page:vertical {\n" " background:rgb(51,51,51);\n" "}") self.vsb_about_home.setOrientation(Qt.Vertical) self.horizontalLayout_28.addWidget(self.vsb_about_home) self.verticalLayout_13.addWidget(self.frame_about_home) self.stackedWidget.addWidget(self.page_about_home) self.horizontalLayout_14.addWidget(self.stackedWidget) self.verticalLayout_2.addWidget(self.frame) self.frame_low = QFrame(self.frame_bottom_east) self.frame_low.setObjectName(u"frame_low") self.frame_low.setMinimumSize(QSize(0, 20)) self.frame_low.setMaximumSize(QSize(16777215, 20)) self.frame_low.setStyleSheet(u"") self.frame_low.setFrameShape(QFrame.NoFrame) self.frame_low.setFrameShadow(QFrame.Plain) self.horizontalLayout_11 = QHBoxLayout(self.frame_low) self.horizontalLayout_11.setSpacing(0) self.horizontalLayout_11.setObjectName(u"horizontalLayout_11") self.horizontalLayout_11.setContentsMargins(0, 0, 0, 0) self.frame_tab = QFrame(self.frame_low) self.frame_tab.setObjectName(u"frame_tab") font10 = QFont() font10.setFamily(u"Segoe UI") self.frame_tab.setFont(font10) self.frame_tab.setStyleSheet(u"background:rgb(51,51,51);") self.frame_tab.setFrameShape(QFrame.NoFrame) self.frame_tab.setFrameShadow(QFrame.Plain) self.horizontalLayout_12 = QHBoxLayout(self.frame_tab) self.horizontalLayout_12.setSpacing(0) self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(0, 0, 0, 0) self.lab_tab = QLabel(self.frame_tab) self.lab_tab.setObjectName(u"lab_tab") font11 = QFont() font11.setFamily(u"Segoe UI Light") font11.setPointSize(10) self.lab_tab.setFont(font11) self.lab_tab.setStyleSheet(u"color:rgb(255,255,255);") self.horizontalLayout_12.addWidget(self.lab_tab) self.horizontalLayout_11.addWidget(self.frame_tab) self.frame_drag = QFrame(self.frame_low) self.frame_drag.setObjectName(u"frame_drag") self.frame_drag.setMinimumSize(QSize(20, 20)) self.frame_drag.setMaximumSize(QSize(20, 20)) self.frame_drag.setStyleSheet(u"background:rgb(51,51,51);") self.frame_drag.setFrameShape(QFrame.NoFrame) self.frame_drag.setFrameShadow(QFrame.Plain) self.horizontalLayout_13 = QHBoxLayout(self.frame_drag) self.horizontalLayout_13.setSpacing(0) self.horizontalLayout_13.setObjectName(u"horizontalLayout_13") self.horizontalLayout_13.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_11.addWidget(self.frame_drag) self.verticalLayout_2.addWidget(self.frame_low) self.horizontalLayout_2.addWidget(self.frame_bottom_east) self.verticalLayout.addWidget(self.frame_bottom) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.stackedWidget.setCurrentIndex(7) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.toodle.setText("") self.lab_appname.setText( QCoreApplication.translate("MainWindow", u"<html><head/><body><p><br/></p></body></html>", None)) self.bn_min.setToolTip(QCoreApplication.translate("MainWindow", u"Minimize", None)) self.bn_min.setText("") self.bn_max.setToolTip(QCoreApplication.translate("MainWindow", u"Maximize", None)) self.bn_max.setText("") self.bn_close.setToolTip(QCoreApplication.translate("MainWindow", u"Close", None)) self.bn_close.setText("") self.bn_home.setToolTip(QCoreApplication.translate("MainWindow", u"Home", None)) self.bn_home.setText("") self.lab_about_home.setText(QCoreApplication.translate("MainWindow", u"How to use", None)) self.bn_home_image.setText(QCoreApplication.translate("MainWindow", u"Upload Image", None)) self.bn_home_rec.setText(QCoreApplication.translate("MainWindow", u"Recognition", None)) self.lab_tab.setText( QCoreApplication.translate("MainWindow", u"<html><head/><body><p><br/></p></body></html>", None)) self.frame_drag.setToolTip(QCoreApplication.translate("MainWindow", u"Drag", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(787, 415) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.base = QFrame(self.centralwidget) self.base.setObjectName(u"base") self.base.setStyleSheet(u"QFrame{\n" "\n" " \n" " background-color: rgb(97, 101, 157);\n" "}") self.base.setFrameShape(QFrame.StyledPanel) self.base.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self.base) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.frame_for_widgets = QFrame(self.base) self.frame_for_widgets.setObjectName(u"frame_for_widgets") self.frame_for_widgets.setStyleSheet( u"QFrame{\n" "\n" "border-radius:25px;\n" "\n" "\n" "\n" "background-color: rgb(24, 25, 39);\n" "\n" "\n" "\n" "\n" "\n" "\n" "}") self.frame_for_widgets.setFrameShape(QFrame.NoFrame) self.frame_for_widgets.setFrameShadow(QFrame.Raised) self.verticalLayout_4 = QVBoxLayout(self.frame_for_widgets) self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.frame = QFrame(self.frame_for_widgets) self.frame.setObjectName(u"frame") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy) self.frame.setFrameShape(QFrame.StyledPanel) self.frame.setFrameShadow(QFrame.Raised) self.horizontalLayout_2 = QHBoxLayout(self.frame) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.select_zip_button = QPushButton(self.frame) self.select_zip_button.setObjectName(u"select_zip_button") self.select_zip_button.setMinimumSize(QSize(75, 75)) self.select_zip_button.setMaximumSize(QSize(75, 75)) font = QFont() font.setFamily(u"Segoe UI Light") font.setPointSize(24) self.select_zip_button.setFont(font) self.select_zip_button.setStyleSheet( u"QPushButton{\n" " color:rgb(30, 149, 198);\n" " border: 2px solid black;\n" "\n" " border-color:rgb(240, 123, 255);\n" " \n" " background-color: rgb(42, 44, 68);\n" " \n" " border-radius:10px;\n" "}\n" "QPushButton:hover{\n" "\n" "\n" "border-color:rgb(255, 37, 255);\n" "\n" "\n" "}") self.horizontalLayout_2.addWidget(self.select_zip_button) self.horizontalSpacer = QSpacerItem(331, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_2.addItem(self.horizontalSpacer) self.verticalLayout_4.addWidget(self.frame) self.frame_left_middle = QFrame(self.frame_for_widgets) self.frame_left_middle.setObjectName(u"frame_left_middle") self.frame_left_middle.setFrameShape(QFrame.StyledPanel) self.frame_left_middle.setFrameShadow(QFrame.Raised) self.verticalLayout_5 = QVBoxLayout(self.frame_left_middle) self.verticalLayout_5.setSpacing(0) self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.verticalLayout_5.setContentsMargins(0, 0, 0, 0) self.frame_left_middle_up = QFrame(self.frame_left_middle) self.frame_left_middle_up.setObjectName(u"frame_left_middle_up") self.frame_left_middle_up.setFrameShape(QFrame.StyledPanel) self.frame_left_middle_up.setFrameShadow(QFrame.Raised) self.horizontalLayout_4 = QHBoxLayout(self.frame_left_middle_up) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.label = QLabel(self.frame_left_middle_up) self.label.setObjectName(u"label") font1 = QFont() font1.setFamily(u"Arial Rounded MT Bold") font1.setPointSize(11) self.label.setFont(font1) self.label.setStyleSheet(u"QLabel{\n" " color:rgb(30, 149, 198);\n" "\n" " \n" "\n" " }") self.label.setAlignment(Qt.AlignCenter) self.horizontalLayout_3.addWidget(self.label) self.lineEdit = QLineEdit(self.frame_left_middle_up) self.lineEdit.setObjectName(u"lineEdit") self.lineEdit.setStyleSheet(u"QLineEdit{\n" "color:rgb(30, 149, 198);\n" " background-color: rgb(65, 69, 106);\n" "\n" "border:2px solid black;\n" "\n" "border-radius:3px;\n" "border-color:rgb(240, 123, 255);\n" "\n" "}") self.horizontalLayout_3.addWidget(self.lineEdit) self.same_as_zip_name_checkbox = QCheckBox(self.frame_left_middle_up) self.same_as_zip_name_checkbox.setObjectName( u"same_as_zip_name_checkbox") font2 = QFont() font2.setFamily(u"Arial Rounded MT Bold") font2.setPointSize(10) self.same_as_zip_name_checkbox.setFont(font2) self.same_as_zip_name_checkbox.setStyleSheet( u"QCheckBox{\n" "color:rgb(30, 149, 198);\n" "\n" "}\n" "QCheckBox:unchecked {\n" " \n" " color:rgb(30, 149, 198);\n" "}\n" "QCheckBox::indicator {\n" " width: 13px;\n" " height: 13px;\n" " \n" " color: rgb(30, 149, 198);\n" " background-color: rgb(42, 44, 68);\n" "}\n" "QCheckBox::indicator:checked {\n" " \n" " \n" " background-color: rgb(192, 98, 204);\n" "}\n" "QCheckBox:checked {\n" "\n" "color: rgb(38, 194, 255);\n" " \n" "}\n" "\n" "QCheckBox::indicator:checked {\n" "color: rgb(253, 111, 54);\n" " \n" "}\n" "") self.horizontalLayout_3.addWidget(self.same_as_zip_name_checkbox) self.horizontalLayout_4.addLayout(self.horizontalLayout_3) self.horizontalSpacer_2 = QSpacerItem(85, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_4.addItem(self.horizontalSpacer_2) self.verticalLayout_5.addWidget(self.frame_left_middle_up) self.frame_3 = QFrame(self.frame_left_middle) self.frame_3.setObjectName(u"frame_3") self.frame_3.setFrameShape(QFrame.StyledPanel) self.frame_3.setFrameShadow(QFrame.Raised) self.horizontalLayout_6 = QHBoxLayout(self.frame_3) self.horizontalLayout_6.setObjectName(u"horizontalLayout_6") self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.label_2 = QLabel(self.frame_3) self.label_2.setObjectName(u"label_2") self.label_2.setMinimumSize(QSize(100, 0)) font3 = QFont() font3.setFamily(u"Segoe UI") font3.setPointSize(12) self.label_2.setFont(font3) self.label_2.setStyleSheet(u"QLabel{\n" "\n" " \n" " \n" " color:rgb(30, 149, 198);\n" "\n" " \n" "\n" " }") self.label_2.setAlignment(Qt.AlignCenter) self.horizontalLayout_5.addWidget(self.label_2) self.algorithm_combobox = QComboBox(self.frame_3) self.algorithm_combobox.addItem("") self.algorithm_combobox.addItem("") self.algorithm_combobox.addItem("") self.algorithm_combobox.addItem("") self.algorithm_combobox.setObjectName(u"algorithm_combobox") self.algorithm_combobox.setMinimumSize(QSize(150, 0)) font4 = QFont() font4.setFamily(u"Segoe UI") font4.setPointSize(10) font4.setBold(True) font4.setWeight(75) self.algorithm_combobox.setFont(font4) self.algorithm_combobox.setStyleSheet( u"QComboBox{\n" "\n" " \n" " color:rgb(30, 149, 198);\n" "\n" " border:2px solid black;\n" " border-color:rgb(240, 123, 255);\n" " background-color: rgb(42, 44, 68);\n" " \n" "\n" "}\n" "QComboBox::down-arrow {\n" " border:1px solid black;\n" "border-color:rgb(30, 149, 198);\n" "}\n" "\n" "ComboBox::drop-down {\n" " \n" " color: rgb(30, 149, 198);\n" " background-color: rgb(56, 58, 91);\n" "}\n" "\n" "\n" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */\n" " top: 1px;\n" " left: 1px;\n" "}\n" "") self.horizontalLayout_5.addWidget(self.algorithm_combobox) self.horizontalLayout_6.addLayout(self.horizontalLayout_5) self.horizontalSpacer_3 = QSpacerItem(146, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_6.addItem(self.horizontalSpacer_3) self.verticalLayout_5.addWidget(self.frame_3) self.verticalLayout_4.addWidget(self.frame_left_middle) self.frame_left_bottom = QFrame(self.frame_for_widgets) self.frame_left_bottom.setObjectName(u"frame_left_bottom") self.frame_left_bottom.setFrameShape(QFrame.StyledPanel) self.frame_left_bottom.setFrameShadow(QFrame.Raised) self.verticalLayout_6 = QVBoxLayout(self.frame_left_bottom) self.verticalLayout_6.setSpacing(0) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(0, 0, 0, 0) self.frame_for_start_button = QFrame(self.frame_left_bottom) self.frame_for_start_button.setObjectName(u"frame_for_start_button") self.frame_for_start_button.setFrameShape(QFrame.StyledPanel) self.frame_for_start_button.setFrameShadow(QFrame.Raised) self.horizontalLayout_8 = QHBoxLayout(self.frame_for_start_button) self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.horizontalLayout_7 = QHBoxLayout() self.horizontalLayout_7.setObjectName(u"horizontalLayout_7") self.label_3 = QLabel(self.frame_for_start_button) self.label_3.setObjectName(u"label_3") self.label_3.setMinimumSize(QSize(100, 0)) self.label_3.setFont(font2) self.label_3.setStyleSheet(u"QLabel{\n" "\n" " \n" " color:rgb(30, 149, 198);\n" "\n" " \n" "\n" " }") self.label_3.setAlignment(Qt.AlignCenter) self.horizontalLayout_7.addWidget(self.label_3) self.toolButton = QToolButton(self.frame_for_start_button) self.toolButton.setObjectName(u"toolButton") self.toolButton.setStyleSheet(u"QToolButton{\n" " color:rgb(30, 149, 198);\n" " border: 2px solid black;\n" "\n" " border-color:rgb(240, 123, 255);\n" " \n" " background-color: rgb(42, 44, 68);\n" " \n" " border-radius:1px;\n" "}\n" "QToolButton:hover{\n" "\n" "\n" "border-color:rgb(255, 37, 255);\n" "\n" "\n" "}") self.horizontalLayout_7.addWidget(self.toolButton) self.horizontalLayout_8.addLayout(self.horizontalLayout_7) self.horizontalSpacer_4 = QSpacerItem(190, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_8.addItem(self.horizontalSpacer_4) self.start_button = QPushButton(self.frame_for_start_button) self.start_button.setObjectName(u"start_button") self.start_button.setMinimumSize(QSize(75, 75)) font5 = QFont() font5.setFamily(u"Segoe UI Light") font5.setPointSize(28) self.start_button.setFont(font5) self.start_button.setStyleSheet(u"QPushButton{\n" " color:rgb(30, 149, 198);\n" " border: 2px solid black;\n" "\n" " border-color:rgb(240, 123, 255);\n" " \n" " background-color: rgb(42, 44, 68);\n" " \n" " border-radius:10px;\n" "}\n" "QPushButton:hover{\n" "\n" "\n" "border-color:rgb(255, 37, 255);\n" "\n" "\n" "}") self.horizontalLayout_8.addWidget(self.start_button) self.verticalLayout_6.addWidget(self.frame_for_start_button) self.frame_for_progressbar = QFrame(self.frame_left_bottom) self.frame_for_progressbar.setObjectName(u"frame_for_progressbar") self.frame_for_progressbar.setFrameShape(QFrame.StyledPanel) self.frame_for_progressbar.setFrameShadow(QFrame.Raised) self.horizontalLayout_10 = QHBoxLayout(self.frame_for_progressbar) self.horizontalLayout_10.setObjectName(u"horizontalLayout_10") self.horizontalSpacer_5 = QSpacerItem(13, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_10.addItem(self.horizontalSpacer_5) self.horizontalLayout_9 = QHBoxLayout() self.horizontalLayout_9.setObjectName(u"horizontalLayout_9") self.label_progress = QLabel(self.frame_for_progressbar) self.label_progress.setObjectName(u"label_progress") self.label_progress.setFont(font2) self.label_progress.setStyleSheet(u"QLabel{\n" "\n" " color:rgb(30, 149, 198);\n" " \n" "\n" " }") self.label_progress.setAlignment(Qt.AlignCenter) self.horizontalLayout_9.addWidget(self.label_progress) self.progressBar = QProgressBar(self.frame_for_progressbar) self.progressBar.setObjectName(u"progressBar") self.progressBar.setMinimumSize(QSize(350, 20)) self.progressBar.setMaximumSize(QSize(450, 20)) font6 = QFont() font6.setFamily(u"Segoe UI") font6.setPointSize(9) self.progressBar.setFont(font6) self.progressBar.setStyleSheet(u"QProgressBar{\n" "\n" " \n" " color:rgb(30, 149, 198);\n" "\n" " border: 1px solid black;\n" "\n" " border-color:rgb(240, 123, 255);\n" " \n" " background-color: rgb(42, 44, 68);\n" " \n" " border-radius:2px;\n" "}\n" "QProgressBar::chunk{\n" "\n" "border-radius:2px;\n" "\n" " background-color:rgb(30, 149, 198);\n" "}\n" "QProgressBar:hover{\n" "border-color:rgb(255, 37, 255);\n" "}") self.progressBar.setMaximum(100) self.progressBar.setValue(56) self.progressBar.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.progressBar.setTextVisible(True) self.progressBar.setInvertedAppearance(False) self.horizontalLayout_9.addWidget(self.progressBar) self.horizontalLayout_10.addLayout(self.horizontalLayout_9) self.verticalLayout_6.addWidget(self.frame_for_progressbar) self.verticalLayout_4.addWidget(self.frame_left_bottom) self.horizontalLayout.addWidget(self.frame_for_widgets) self.frame_for_textedit = QFrame(self.base) self.frame_for_textedit.setObjectName(u"frame_for_textedit") sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.frame_for_textedit.sizePolicy().hasHeightForWidth()) self.frame_for_textedit.setSizePolicy(sizePolicy1) self.frame_for_textedit.setMinimumSize(QSize(30, 0)) self.frame_for_textedit.setMaximumSize(QSize(350, 16777215)) self.frame_for_textedit.setFrameShape(QFrame.StyledPanel) self.frame_for_textedit.setFrameShadow(QFrame.Raised) self.verticalLayout_2 = QVBoxLayout(self.frame_for_textedit) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(-1, 0, 0, 0) self.terminal_output = QTextEdit(self.frame_for_textedit) self.terminal_output.setObjectName(u"terminal_output") self.terminal_output.setFont(font2) self.terminal_output.setStyleSheet( u"\n" "QTextEdit, QListView {\n" " color:rgb(255, 37, 255);\n" " background-color:rgb(40, 41, 65);\n" " border:3px solid black;\n" " border-radius:10px;\n" " border-color:rgb(30, 149, 198);\n" " background-attachment: scroll;\n" "}") self.verticalLayout_2.addWidget(self.terminal_output) self.horizontalLayout.addWidget(self.frame_for_textedit) self.verticalLayout.addWidget(self.base) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.select_zip_button.setText( QCoreApplication.translate("MainWindow", u"Zip", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Video Name :", None)) self.same_as_zip_name_checkbox.setText( QCoreApplication.translate("MainWindow", u"Same as Zip name", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"Algorithm", None)) self.algorithm_combobox.setItemText( 0, QCoreApplication.translate("MainWindow", u"Select", None)) self.algorithm_combobox.setItemText( 1, QCoreApplication.translate("MainWindow", u"Very Fast - Good", None)) self.algorithm_combobox.setItemText( 2, QCoreApplication.translate("MainWindow", u"Fast - Better", None)) self.algorithm_combobox.setItemText( 3, QCoreApplication.translate("MainWindow", u"Slow - Best", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"Video Location", None)) self.toolButton.setText( QCoreApplication.translate("MainWindow", u"...", None)) self.start_button.setText( QCoreApplication.translate("MainWindow", u"Start", None)) self.label_progress.setText( QCoreApplication.translate("MainWindow", u"Progress :", None)) self.terminal_output.setHtml( QCoreApplication.translate( "MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'Arial Rounded MT Bold'; font-size:10pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Segoe UI Light'; color:#f07bff;\">Zipvy Ready...</span></p></body></html>", None))