def __init__(self): super(GuiCam, self).__init__() self.cameras = [] self.cam_sync = True # Create Camera sub_window contents self.list_cameras = QListWidget() self.list_cameras.setAlternatingRowColors(True) self.button_select_camera = QPushButton("Select Camera") # Add availableCameras to a list to be displayed in list widget. # Use QCameraInfo() to auto detected local camera(s) and list available cameras. # cameras = QCameraInfo().availableCameras() # self.init_list(self.list_cameras, [cam.deviceName() for cam in list(cameras)]) # + list(videos)) self.init_list(self.list_cameras, ["Front Camera", "Real Camera"]) # + list(videos)) # dictionary data structure to construct camera filter functions tuning parameters self.functions = {thresholding: [["0: Disable Filter; 1:Active Filter", 1], ["0:gray; 1:Simple Thresholding; 2:Adaptive Thresholding", 0], ["Simple Thresholding: 0:BINARY; 1:BINARY_INV; 2:TRUNC; 3:TOZERO; " "4:TOZERO_INV; 5:THRESH_OTSU", 0], ["Simple Thresholding: Threshold value", 127], ["Kernel", 0]], smoothing: [["0: Disable Filter; 1:Active Filter", 1], ["0:Averaging; 1:Gaussian; 2:Median; 3: Bilateral; 4: De Noise", 0], ["", 0], ["", 0], ["Kernel", 0]], morphology: [["0: Disable Filter; 1:Active Filter", 1], ["0:Erosion; 1:Dilation; 2:Morphology; ", 0], ["Morphology Operator 0:Open;1:Close;2:GRADIENT;3:TOPHAT;4:BLACKHAT", 0], ["morph_element 0:RECT; 1:CROSS; 2:ELLIPSE", 0], ["Kernel", 0]], histograms: [["0: Disable Filter; 1:Active Filter", 1], ["0:Equalization; 1:adaptive equalization; 2:Contrast&Brightness; 3:gamma; " "4:low-light;", 0], ["alpha-contrast", 50], ["beta-brightness", 50], ["", 0]], arithmetic: [["0: Disable Filter; 1:Active Filter", 1], ["", 0], ["Scale", 0], ["alpha-contrast", 50], ["beta-brightness", 50]], transformations: [["0: Disable Filter; 1:Active Filter", 1], ["0:Scaling(select rect); 1:Perspective(by select 4 points); " "2:Affine(by select 3 points);", 0], ["Scaling factor", 0], ["", 0], ["", 0]], extraction: [["0: Disable Filter; 1:Active Filter", 1], ["", 0], ["", 0], ["", 0], ["", 0]], none: [["", 0], ["", 0], ["", 0], ["", 0], ["", 0]], } # hold camera filter functions # data struct: {function: [["description", value],,,]} self.spinbox_tip_value = [] # Camera AI parts self.models = [BarCode, Color, CascadeClassifier, Diff2frame, Diff3frame, Background, Lane, Face, HOGDescriptor, GoodFeature, Tracker, CamShift, Template, ColorShape, Feature, SimpleBlob, Caffe, Tensorflow, Yolo, GrabCut, Model, ] self.spin_boxes = [] # hold camera filter function parameters using spinbox value self.list_functions = QListWidget() self.list_functions.setAlternatingRowColors(True) self.button_select_filter = QPushButton("Select filter") self.dialog_color = QColorDialog() self.camera_contents = QWidget() self.dock_camera = QDockWidget() self.filter_contents = QWidget() self.dock_filter = QDockWidget() self.color_contents = QWidget() self.dock_color = QDockWidget() # Create Model sub_window contents # self.models = [] # hold AI models for objects detecting and tracing self.list_models = QListWidget() self.list_models.setAlternatingRowColors(True) self.button_select_model = QPushButton("Select Model") self.gbox_model = QGroupBox() self.sub_window_models = QMdiSubWindow() self.sub_window_models.setAttribute(Qt.WA_DeleteOnClose) self.sub_window_models.setWindowTitle("AI Model") # Create View sub_window contents self.label_image = QLabel() self.label_image.setAlignment(Qt.AlignTop) self.sub_window_view = QMdiSubWindow() self.sub_window_view.setAttribute(Qt.WA_DeleteOnClose) self.sub_window_view.setWindowTitle("View") # Create Menu Actions self.act_file_open = QAction(QIcon('images/open_file.png'), "Open", self) self.act_file_close = QAction(QIcon('images/close_file.png'), "Close", self) self.act_file_save = QAction(QIcon('images/save_file.png'), "Save", self) self.act_file_record = QAction(QIcon('images/record_file.png'), "Record", self) self.act_file_print = QAction(QIcon('images/print.png'), "Print", self) self.act_file_exit = QAction(QIcon('images/exit.png'), 'Exit', self) self.act_edit_image = QAction(QIcon('images/add_image.png'), "Add image", self) self.act_edit_logo = QAction(QIcon('images/add_logo.png'), "Add logo", self) self.init_ui()
def init_UI(self): # Add core elements for the window self.lbl_tittle1 = QLabel("Batalla ", self) self.lbl_tittle1.setStyleSheet("font-weight: bold; color: white; font-family: century gothic; font-size: 29px") self.lbl_tittle1.move(450, 50) self.img_logo = QLabel(self) pixmap = QPixmap("Clases/images/imgTitle.png") self.img_logo.setPixmap(pixmap) self.img_logo.move(550, 5) self.img_logo.setMinimumSize(100, 100) self.lbl_tittle2 = QLabel("Naval ", self) self.lbl_tittle2.setStyleSheet("font-weight: bold; color: white; font-family: century gothic; font-size: 29px") self.lbl_tittle2.move(650, 50) # Button score self.btn_score = QPushButton('Ver puntuación', self) self.btn_score.resize(350, 60) self.btn_score.move(370, 250) self.btn_score.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 18px") # Button Log out self.btn_logout = QPushButton('Cerrar Sesión', self) self.btn_logout.resize(350, 60) self.btn_logout.move(370, 450) self.btn_logout.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 18px") self.btn_logout.clicked.connect(self.logout_clicked) # Button Send self.btn_send = QPushButton("Enviar", self) self.btn_send.resize(165, 35) self.btn_send.move(900, 580) self.btn_send.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px") self.btn_send.clicked.connect(self.play_clicked) # LabeL username self.lbl_username = QLabel(self.username, self) self.lbl_username.setStyleSheet("font-weight: bold; color: white; font-family: century gothic; font-size: 17px") self.lbl_username.move(1130, 95) # Label FRIENDS self.lbl_friends = QLabel("Amigos", self) self.lbl_friends.setStyleSheet("font-weight: bold; color: white; font-family: century gothic; font-size: 18px") self.lbl_friends.move(900, 133) # ListWidget list friends self.list_friends = QListWidget(self) self.list_friends.move(900, 170) self.list_friends.setMinimumSize(250, 400) self.list_friends.setStyleSheet( "background-color: #0277bd; font-weight: bold; color: White; font-family: century gothic; font-size: 15px") # "background-color: WHITE; font-weight: bold; color: BLACK; font-family: century gothic; font-size: 15px") # This window self.setFixedSize(1200, 650) self.center() self.setWindowTitle('Batalla Naval') self.setWindowIcon(QtGui.QIcon('Clases/images/b6.ico')) # Set the baackground image palette = QPalette() palette.setBrush(QPalette.Background, QBrush(QPixmap("Clases/images/fondo.png"))) self.setPalette(palette) # self.timer = QTimer(self) # self.timer.timeout.connect(self.update_list) # self.timer.start(3000) self.windowGame = WindowBattle(self.selected_lenguage) self.windowGame.hide() self.show()
chk_box4.setTristate(False) ## example to detect change state checkBox.stateChanged.connect(self.enlarge_window) ## label.setScaledContents(chk_box3.isChecked()) # ==== Sliders ===== # slide1 = QSlider(Qt.Horizontal) slide1.setMinimum(-40) slide1.setMaximum(40) slide1.setValue(0) slide1.setTickPosition(QSlider.TicksBelow) #TicksBothSides, TicksBelow slide1.setSingleStep(1) slide1.setTickInterval(4) slide1.valueChanged.connect(rotation_value) # ==== Buttons ==== # console_list = QListWidget() console_list.setFixedSize(win_length * 0.7, 100) # ==== plot ===== # plot = pg.PlotWidget() # ==== Progress Bar ===== # bar1 = QProgressBar() # ==== Dropdown Menu ===== # menu1 = QComboBox() menu1.addItem('AVI') menu1.addItem('MJPG') menu1.addItem('MP4') box1 = QGroupBox('Buttons')
def __init__(self, parent=None): QMainWindow.__init__(self, parent) self.interface_lng_val = 'Russian' if self.interface_lng_val == 'Russian': self.setWindowTitle("Графический интерфейс программы OpenFOAM") elif self.interface_lng_val == 'English': self.setWindowTitle("OpenFOAM_decompose_GUI") # Базовые переменные self.full_dir = '' self.prj_name = '' self.con = '' self.lock_bool = False self.application = '' # ---------------------------Панель управления подготовкой задачи МСС----------------------------- # self.proj_open = QAction(self) self.proj_open.setEnabled(True) proj_ico = self.style().standardIcon(QStyle.SP_ArrowUp) self.proj_open.setIcon(proj_ico) if self.interface_lng_val == 'Russian': self.proj_open.setToolTip('Открыть проект') elif self.interface_lng_val == 'English': self.proj_open.setToolTip('Open the project') self.lng_chs = QAction(self) self.lng_chs.setEnabled(True) lng_chs_ico = self.style().standardIcon( QStyle.SP_FileDialogDetailedView) self.lng_chs.setIcon(lng_chs_ico) if self.interface_lng_val == 'Russian': self.lng_chs.setToolTip('Выбрать язык интерфейса программы') elif self.interface_lng_val == 'English': self.lng_chs.setToolTip('Select the interface language') self.file_open = QAction(self) self.file_open.setEnabled(False) file_open_ico = self.style().standardIcon(QStyle.SP_FileIcon) self.file_open.setIcon(file_open_ico) if self.interface_lng_val == 'Russian': self.file_open.setToolTip( 'Открыть форму создания служебного файла для директории 0') elif self.interface_lng_val == 'English': self.file_open.setToolTip( 'Open the form for creating the service file for the directory 0' ) self.toolBar_1 = QToolBar("MyToolBar") self.toolBar_1.addAction(self.proj_open) self.toolBar_1.addAction(self.lng_chs) self.toolBar_1.addAction(self.file_open) self.proj_open.triggered.connect( lambda: first_toolbar_functions_class.on_proj_open(self)) self.lng_chs.triggered.connect( lambda: first_toolbar_functions_class.on_lng_chs(self)) self.file_open.triggered.connect( lambda: first_toolbar_functions_class.on_0_files_window_chs(self)) self.addToolBar(self.toolBar_1) ###----------------------Панель управления подготовкой РС--------------------------### self.msh_open = QAction(self) self.msh_open.setEnabled(False) msh_ico = self.style().standardIcon(QStyle.SP_FileDialogNewFolder) self.msh_open.setIcon(msh_ico) if self.interface_lng_val == 'Russian': self.msh_open.setToolTip('Открыть форму выбора расчетной сетки') elif self.interface_lng_val == 'English': self.msh_open.setToolTip('Open the mesh selection form') self.msh_run = QAction(self) self.msh_run.setEnabled(False) msh_ico = self.style().standardIcon(QStyle.SP_ArrowRight) self.msh_run.setIcon(msh_ico) if self.interface_lng_val == 'Russian': self.msh_run.setToolTip('Выполнить генерацию расчетной сетки') elif self.interface_lng_val == 'English': self.msh_run.setToolTip('Make the mesh generation') self.msh_visual = QAction(self) self.msh_visual.setEnabled(False) msh_visual_ico = self.style().standardIcon(QStyle.SP_MediaSeekForward) self.msh_visual.setIcon(msh_visual_ico) if self.interface_lng_val == 'Russian': self.msh_visual.setToolTip( 'Выполнить визуализацию расчетной сетки') elif self.interface_lng_val == 'English': self.msh_visual.setToolTip('Make the mesh visualization') self.toolBar_2 = QToolBar() self.toolBar_2.addAction(self.msh_open) self.toolBar_2.addAction(self.msh_run) self.toolBar_2.addAction(self.msh_visual) self.msh_open.triggered.connect( lambda: second_toolbar_functions_class.on_msh_open(self)) self.msh_run.triggered.connect( lambda: second_toolbar_functions_class.on_msh_run( prj_path_val, mesh_name_txt_val, pp_dir, self, self. interface_lng_val, msh_type)) self.msh_visual.triggered.connect( lambda: second_toolbar_functions_class.on_visual_msh_run( prj_path_val, mesh_name_txt_val, pp_dir, self, self. interface_lng_val, msh_type)) self.addToolBar(self.toolBar_2) self.insertToolBarBreak(self.toolBar_2) ###----------------------Панель управления решением задачи МСС--------------------------### self.solv_run = QAction(self) self.solv_run.setEnabled(False) solv_run_ico = self.style().standardIcon(QStyle.SP_DialogNoButton) self.solv_run.setIcon(solv_run_ico) if self.interface_lng_val == 'Russian': self.solv_run.setToolTip('Выполнить решение') elif self.interface_lng_val == 'English': self.solv_run.setToolTip('Run solution') self.solv_stop = QAction(self) self.solv_stop.setEnabled(False) close_ico = self.style().standardIcon(QStyle.SP_DockWidgetCloseButton) self.solv_stop.setIcon(close_ico) if self.interface_lng_val == 'Russian': self.solv_stop.setToolTip('Остановить процесс решения') elif self.interface_lng_val == 'English': self.solv_stop.setToolTip('Stop the solution process') self.solv_run_vis = QAction(self) self.solv_run_vis.setEnabled(False) solv_run_vis_ico = self.style().standardIcon(QStyle.SP_CommandLink) self.solv_run_vis.setIcon(solv_run_vis_ico) if self.interface_lng_val == 'Russian': self.solv_run_vis.setToolTip( 'Выполнить визуализацию результатов решения') elif self.interface_lng_val == 'English': self.solv_run_vis.setToolTip('Visualize the solution results') self.toolBar_3 = QToolBar() self.toolBar_3.addAction(self.solv_run) self.toolBar_3.addAction(self.solv_stop) self.toolBar_3.addAction(self.solv_run_vis) self.solv_run.triggered.connect( lambda: second_toolbar_functions_class.on_solv_run( prj_path_val, mesh_name_txt_val, pp_dir, self, self. interface_lng_val, msh_type)) self.solv_stop.triggered.connect( lambda: second_toolbar_functions_class.on_solv_stop( prj_path_val, mesh_name_txt_val, pp_dir, self, self. interface_lng_val, msh_type)) self.solv_run_vis.triggered.connect( lambda: second_toolbar_functions_class.on_solv_vis( prj_path_val, mesh_name_txt_val, pp_dir, self, self. interface_lng_val, msh_type)) self.addToolBar(self.toolBar_3) self.insertToolBarBreak(self.toolBar_3) ###----------------Верхний виджет с полным путем до файла сетки----------------### self.tdw = QDockWidget() self.tdw.setFixedSize(1400, 65) self.tdw.setFeatures(self.tdw.NoDockWidgetFeatures) self.tdw_grid = QGridLayout() self.tdw_grid.setColumnStretch(2, 1) self.tdw_frame = QFrame() self.tdw_frame.setStyleSheet("background-color: ghostwhite;" "border-width: 0.5px;" "border-style: solid;" "border-color: silver;") self.tdw_frame.setLayout(self.tdw_grid) self.tdw.setWidget(self.tdw_frame) self.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.tdw) ###-----------------Левый виджет с файловой системой проекта---------------------### self.fsw = QDockWidget() self.fsw.setFeatures(self.fsw.NoDockWidgetFeatures) self.fsw_label = QLabel() self.fsw_label.setAlignment(QtCore.Qt.AlignCenter) self.fsw_grid = QGridLayout() self.fsw_grid.addWidget(self.fsw_label, 0, 0) self.fsw_frame = QFrame() self.fsw_frame.setFixedSize(200, 35) self.fsw_frame.setStyleSheet("background-color: honeydew;" "border-width: 1px;" "border-style: solid;" "border-color: dimgray;" "border-radius: 4px;") self.fsw_frame.setLayout(self.fsw_grid) if self.interface_lng_val == 'Russian': fs_lbl = "Файловая Cтруктура Проекта" elif self.interface_lng_val == 'English': fs_lbl = "File Structure of the Project" self.fsw_label.setText("<font color='SeaGreen'>" + fs_lbl + "</font>") self.fsw_label.setStyleSheet("border-style: none;" "font-size: 10pt;") self.fsw.setTitleBarWidget(self.fsw_frame) self.treeview = QTreeView() self.treeview.setFixedSize(200, 520) self.treeview.model = QtGui.QStandardItemModel() self.treeview.setModel(self.treeview.model) self.treeview.setColumnWidth(0, 100) self.treeview.setColumnHidden(1, True) self.treeview.setColumnHidden(2, True) self.treeview.setColumnHidden(3, True) self.treeview.header().hide() self.treeview.setItemsExpandable(False) self.treeview.clicked.connect(self.on_treeview_clicked) self.fsw.setWidget(self.treeview) ###-----------Правый виджет с формой вывода результатов генерации файлов-----------### self.cdw = QDockWidget() self.cdw.setFeatures(self.cdw.NoDockWidgetFeatures) self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.cdw) self.cdw_grid = QGridLayout() self.cdw_frame = QFrame() self.cdw_frame.setFixedSize(495, 35) self.cdw_frame.setStyleSheet("border-width: 1px;" "border-style: solid;" "border-color: dimgray;" "border-radius: 4px;" "background-color: honeydew;") self.cdw_frame.setLayout(self.cdw_grid) self.outf_lbl = QLabel() self.outf_lbl.setAlignment(QtCore.Qt.AlignCenter) self.outf_lbl.setStyleSheet("border-style: none;" "font-size: 9pt;") self.cdw_grid.addWidget(self.outf_lbl, 0, 0) self.outf_edit = QTextEdit() self.outf_scroll = QScrollArea() self.outf_scroll.setWidgetResizable(True) self.outf_scroll.setWidget(self.outf_edit) self.outf_scroll.setFixedSize(495, 520) ###-----------------Центральный виджет с формой параметров---------------------### self.ffw = QDockWidget() self.ffw.setFeatures(self.ffw.NoDockWidgetFeatures) self.ffw_label = QLabel() self.ffw_label.setAlignment(QtCore.Qt.AlignCenter) self.ffw_grid = QGridLayout() self.ffw_grid.addWidget(self.ffw_label, 0, 0) self.ffw_frame = QFrame() self.ffw_frame.setFixedSize(693, 44) self.ffw_frame.setStyleSheet("border-width: 1px;" "border-style: solid;" "border-color: dimgray;" "border-radius: 4px;" "background-color: honeydew;") self.ffw_frame.setLayout(self.ffw_grid) ###------------------Нижний виджет со служебными сообщениями------------------### if self.interface_lng_val == 'Russian': self.serv_mes = QDockWidget("Служебные сообщения") elif self.interface_lng_val == 'English': self.serv_mes = QDockWidget("Service messages") self.serv_mes.setFixedSize(1400, 160) self.serv_mes.setFeatures(self.serv_mes.NoDockWidgetFeatures) self.listWidget = QListWidget() self.serv_mes.setWidget(self.listWidget)
def __init__(self): super().__init__() # 使用QListWidget来记录已有的图元,并用于选择图元。 #注:这是图元选择的简单实现方法,更好的实现是在画布中直接用鼠标选择图元 self.list_widget = QListWidget(self) self.list_widget.setMinimumWidth(200) # 使用QGraphicsView作为画布 self.scene = QGraphicsScene(self) self.scene.setSceneRect(0, 0, 600, 600) self.canvas_widget = MyCanvas(self.scene, self) self.canvas_widget.setFixedSize(600, 600) self.canvas_widget.main_window = self self.canvas_widget.list_widget = self.list_widget self.canvas_widget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.canvas_widget.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) # 设置菜单栏 menubar = self.menuBar() file_menu = menubar.addMenu('文件') set_pen_act = file_menu.addAction('设置画笔') reset_canvas_act = file_menu.addAction('重置画布') save_canvas_act = file_menu.addAction('保存画布') exit_act = file_menu.addAction('退出') draw_menu = menubar.addMenu('绘制') line_menu = draw_menu.addMenu('线段') line_naive_act = line_menu.addAction('Naive') line_dda_act = line_menu.addAction('DDA') line_bresenham_act = line_menu.addAction('Bresenham') polygon_menu = draw_menu.addMenu('多边形') polygon_dda_act = polygon_menu.addAction('DDA') polygon_bresenham_act = polygon_menu.addAction('Bresenham') ellipse_act = draw_menu.addAction('椭圆') curve_menu = draw_menu.addMenu('曲线') curve_bezier_act = curve_menu.addAction('Bezier') curve_b_spline_act = curve_menu.addAction('B-spline') edit_menu = menubar.addMenu('编辑') translate_act = edit_menu.addAction('平移') rotate_act = edit_menu.addAction('旋转') scale_act = edit_menu.addAction('缩放') clip_menu = edit_menu.addMenu('裁剪') clip_cohen_sutherland_act = clip_menu.addAction('Cohen-Sutherland') clip_liang_barsky_act = clip_menu.addAction('Liang-Barsky') # 连接信号和槽函数 set_pen_act.triggered.connect(self.set_pen_action) reset_canvas_act.triggered.connect(self.reset_canvas_action) save_canvas_act.triggered.connect(self.save_canvas_action) exit_act.triggered.connect(self.exit_action) line_naive_act.triggered.connect(self.line_naive_action) line_dda_act.triggered.connect(self.line_dda_action) line_bresenham_act.triggered.connect(self.line_bresenham_action) polygon_dda_act.triggered.connect(self.polygon_dda_action) polygon_bresenham_act.triggered.connect(self.polygon_bresenham_action) ellipse_act.triggered.connect(self.ellipse_action) curve_bezier_act.triggered.connect(self.curve_bezier_action) curve_b_spline_act.triggered.connect(self.curve_b_spline_action) translate_act.triggered.connect(self.translate_action) rotate_act.triggered.connect(self.rotate_action) scale_act.triggered.connect(self.scale_action) clip_cohen_sutherland_act.triggered.connect( self.clip_cohen_sutherland_action) clip_liang_barsky_act.triggered.connect(self.clip_liang_barsky_action) self.list_widget.currentTextChanged.connect( self.canvas_widget.selection_changed) # 设置主窗口的布局 self.hbox_layout = QHBoxLayout() self.hbox_layout.addWidget(self.canvas_widget) self.hbox_layout.addWidget(self.list_widget, stretch=1) self.central_widget = QWidget() self.central_widget.setLayout(self.hbox_layout) self.setCentralWidget(self.central_widget) self.statusBar().showMessage('空闲') self.resize(600, 600) self.setWindowTitle('CG Demo')
def __init__(self, chan_name, group_name, config_value, s_freq): super().__init__() self.chan_name = chan_name self.group_name = group_name self.idx_l0 = QListWidget() self.idx_l1 = QListWidget() self.add_channels_to_list(self.idx_l0) self.add_channels_to_list(self.idx_l1) self.idx_hp = QDoubleSpinBox() hp = config_value['hp'] if hp is None: hp = 0 self.idx_hp.setValue(hp) self.idx_hp.setSuffix(' Hz') self.idx_hp.setDecimals(1) self.idx_hp.setMaximum(s_freq / 2) self.idx_hp.setToolTip('0 means no filter') self.idx_lp = QDoubleSpinBox() lp = config_value['lp'] if lp is None: lp = 0 self.idx_lp.setValue(lp) self.idx_lp.setSuffix(' Hz') self.idx_lp.setDecimals(1) self.idx_lp.setMaximum(s_freq / 2) self.idx_lp.setToolTip('0 means no filter') self.idx_scale = QDoubleSpinBox() self.idx_scale.setValue(config_value['scale']) self.idx_scale.setSuffix('x') self.idx_reref = QPushButton('Average') self.idx_reref.clicked.connect(self.rereference) self.idx_color = QColor(config_value['color']) l_form = QFormLayout() l_form.addRow('High-Pass', self.idx_hp) l_form.addRow('Low-Pass', self.idx_lp) r_form = QFormLayout() r_form.addRow('Scaling', self.idx_scale) r_form.addRow('Reference', self.idx_reref) l0_layout = QVBoxLayout() l0_layout.addWidget(QLabel('Active')) l0_layout.addWidget(self.idx_l0) l1_layout = QVBoxLayout() l1_layout.addWidget(QLabel('Reference')) l1_layout.addWidget(self.idx_l1) l_layout = QHBoxLayout() l_layout.addLayout(l0_layout) l_layout.addLayout(l1_layout) lr_form = QHBoxLayout() lr_form.addLayout(l_form) lr_form.addLayout(r_form) layout = QVBoxLayout() layout.addLayout(l_layout) layout.addLayout(lr_form) self.setLayout(layout)
def __init__(self, parent=None): super(GenerateTerrainImage, self).__init__(parent) self.dirList = QListWidget() self.fileList = QListWidget() self.setDirList() self.fileName = "" self.dirName = self.dirList.item(0).text() self.path = "/" + self.dirName + "/" self.dirList.itemSelectionChanged.connect(self.selectDir) self.fileList.itemSelectionChanged.connect(self.selectFile) latLabel = QLabel("lat(緯度): ") self.latEdit = QLineEdit() lonLabel = QLabel("lon(経度): ") self.lonEdit = QLineEdit() editLayout = QGridLayout() editLayout.addWidget(latLabel, 0, 0) editLayout.addWidget(self.latEdit, 0, 1) editLayout.addWidget(lonLabel, 1, 0) editLayout.addWidget(self.lonEdit, 1, 1) startButton = QPushButton("Start") startButton.clicked.connect(self.clickedStart) exitButton = QPushButton("Exit") exitButton.clicked.connect(self.clickedExit) buttonLayout = QHBoxLayout() buttonLayout.addWidget(startButton) buttonLayout.addWidget(exitButton) inputLayout = QVBoxLayout() inputLayout.addWidget(self.dirList) inputLayout.addLayout(editLayout) inputLayout.addLayout(buttonLayout) inputWidget = QWidget() inputWidget.setLayout(inputLayout) self.canvas = QLabel(u" ここに地形図が表示されます ") self.canvas.setScaledContents(True) saveButton = QPushButton("Save Figure") saveButton.clicked.connect(self.clickedSave) figureLayout = QVBoxLayout() figureLayout.addWidget(self.canvas) figureLayout.addWidget(saveButton) figureWidget = QWidget() figureWidget.setLayout(figureLayout) splitter = QSplitter(Qt.Horizontal) splitter.addWidget(inputWidget) splitter.addWidget(figureWidget) splitter.setStretchFactor(1, 1) entireLayout = QHBoxLayout() entireLayout.addWidget(splitter) entireLayout.addWidget(self.fileList) self.setLayout(entireLayout)
def __init__(self, parent=None): super(GuiTabPreprocessANTs, self).__init__(parent) self.selected_subj_ANT = '' self.cfg = Configuration.load_config(ROOTDIR) if os.path.isdir(self.cfg['folders']['nifti']): self.niftidir = self.cfg['folders']['nifti'] else: self.niftidir = FileOperations.set_wdir_in_config(self.cfg, foldername='nifti', init=True) self.cfg['folders']['nifti'] = self.niftidir self.cfg['folders']['rootdir'] = ROOTDIR Configuration.save_config(ROOTDIR, self.cfg) # Customize tab self.lay = QHBoxLayout(self) self.tab = QWidget() self.tab.layout = QHBoxLayout() self.tab.setLayout(self.tab.layout) # ------------------------- Upper left part (Folder) ------------------------- # self.FolderboxTab = QGroupBox('Directory (NIFTI-files)') self.HBoxUpperLeftTab = QVBoxLayout(self.FolderboxTab) self.lblWdirTab = QLabel('wDIR: {}'.format(self.niftidir)) self.HBoxUpperLeftTab.addWidget(self.lblWdirTab) self.btnChangeWdir = QPushButton('Change working directory') self.btnChangeWdir.setToolTip(setToolTips.ChangeWdirNIFTI()) self.btnChangeWdir.clicked.connect(self.change_wdir) self.btnReloadFilesTab = QPushButton('Reload files') self.btnReloadFilesTab.clicked.connect(self.run_reload_files) self.HBoxUpperLeftTab.addWidget(self.btnChangeWdir) self.HBoxUpperLeftTab.addWidget(self.btnReloadFilesTab) # ------------------------- Middle left part (Preferences) ------------------------- # self.SettingsTabANTs = QGroupBox('Preferences') self.HBoxMiddleLeftTabExt = QVBoxLayout(self.SettingsTabANTs) self.btn_ANTsettings = QPushButton('ANT Settings') self.btn_ANTsettings.clicked.connect(self.run_ANTsPreferences) self.btn_ANTsettings.setToolTip(setToolTips.ANTsSettings()) self.HBoxMiddleLeftTabExt.addWidget(self.btn_ANTsettings) # ------------------------- Middle left part (ANTs routines) ------------------------- # self.ActionsTabANTs = QGroupBox('ANTs routines') self.HBoxMiddleLeftTab = QVBoxLayout(self.ActionsTabANTs) self.btn_N4BiasCorr = QPushButton('N4BiasCorrect') self.btn_N4BiasCorr.setToolTip(setToolTips.N4BiasCorrection()) self.btn_N4BiasCorr.clicked.connect(self.run_n4Bias_corr) self.btn_MRIreg = QPushButton('MR-Registration') self.btn_MRIreg.setToolTip(setToolTips.RegisterMRI2template()) self.btn_MRIreg.clicked.connect(self.run_RegisterMRI2template) self.btn_CTreg = QPushButton('CT-Registration') self.btn_CTreg.setToolTip(setToolTips.RegisterCT2MRI()) self.btn_CTreg.clicked.connect(self.run_RegisterCT2MRI) self.HBoxMiddleLeftTab.addWidget(self.btn_N4BiasCorr) self.HBoxMiddleLeftTab.addWidget(self.btn_MRIreg) self.HBoxMiddleLeftTab.addWidget(self.btn_CTreg) # ------------------------- Lower left part (Processing) ------------------------- # self.QualityTabANTs = QGroupBox('Quality checks for ANTs preprocessing') self.HBoxLowerLeftTab = QVBoxLayout(self.QualityTabANTs) self.btn_QC_ANTsPreproc = QPushButton('View available \nNIFTI-files in viewer') self.btn_QC_ANTsPreproc.setToolTip(setToolTips.compareNIFTIfiles()) self.btn_QC_ANTsPreproc.clicked.connect(self.display_nifti_files) self.HBoxLowerLeftTab.addWidget(self.btn_QC_ANTsPreproc) # -------------------- Right part (Subject list) ----------------------- # self.listbox = QGroupBox('Available subjects') self.HBoxUpperRightTab = QVBoxLayout(self.listbox) self.availableNiftiTab = QListWidget() self.availableNiftiTab.setSelectionMode(QAbstractItemView.ExtendedSelection) itemsTab = FileOperations.list_folders(self.niftidir, prefix=self.cfg['folders']['prefix']) self.add_available_items(self.availableNiftiTab, itemsTab, msg='no') self.availableNiftiTab.itemSelectionChanged.connect(self.change_list_item) self.HBoxUpperRightTab.addWidget(self.availableNiftiTab) # Combine all Boxes for Tab 2 Layout self.LeftboxTabANTs = QGroupBox() self.HBoxTabANTsLeft = QVBoxLayout(self.LeftboxTabANTs) self.HBoxTabANTsLeft.addWidget(self.FolderboxTab) self.HBoxTabANTsLeft.addStretch(1) self.HBoxTabANTsLeft.addWidget(self.SettingsTabANTs) self.HBoxTabANTsLeft.addWidget(self.ActionsTabANTs) self.HBoxTabANTsLeft.addWidget(self.QualityTabANTs) self.tab.layout.addWidget(self.LeftboxTabANTs) self.tab.layout.addWidget(self.listbox) self.lay.addWidget(self.tab)
def initUI(self): """# Global """ self.setWindowTitle('Option') self.setFixedSize(800, 450) self.list_option = QListWidget(self) self.stack_window = QStackedWidget(self) self.style_list_option = "QListWidget{\ min-width: 120px;\ max-width: 120px;\ color: white;\ background: grey;}" self.style_groupbox = "QGroupBox{\ border: None;}" self.style_groupbox_font = "QGroupBox{\ font-family: MonoxRegular;\ font-size: 20px;}" layout_main = QHBoxLayout(spacing=0) layout_main.setContentsMargins(0, 0, 0, 0) layout_main.addWidget(self.list_option) layout_main.addWidget(self.stack_window) self.setLayout(layout_main) self.list_option.setStyleSheet(self.style_list_option) """# List Option""" self.list_option.setFrameShape(QListWidget.NoFrame) self.list_option.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.list_option.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.list_option.currentRowChanged.connect( self.stack_window.setCurrentIndex) font = QFont() font.setFamily('MonoxLight') font.setPointSize(20) item = QListWidgetItem() item.setFont(font) item.setText('DIY') item.setSizeHint(QSize(0, 60)) item.setTextAlignment(Qt.AlignCenter) self.list_option.addItem(item) item = QListWidgetItem() item.setFont(font) item.setText('PRO') item.setSizeHint(QSize(0, 60)) item.setTextAlignment(Qt.AlignCenter) self.list_option.addItem(item) """# Stack Window""" """# Page 0""" self.page0 = QWidget() self.tabwidget_page0 = QTabWidget(self.page0) self.tab0_page0 = QWidget(self.page0) self.tab1_page0 = QWidget(self.page0) self.tabwidget_page0.addTab(self.tab0_page0, 'Info') self.tabwidget_page0.addTab(self.tab1_page0, 'Option') self.page0tab0() self.page0tab1() self.page0global() self.page1tab0() self.page1tab1() self.page1global()
def __init__(self, parent=None): super(Controles, self).__init__(parent) self.setWindowFlags(Qt.WindowStaysOnTopHint) self.setWindowTitle("Controles") self.Reproduciendo = False self.strButtonShow = " Ver Reproductor" self.strButtonHide = "Ocultar Reproductor" self.videoVentana = VideoWindow() self.videoVentana.setControles(self) self.videoVentana.setWindowFlags(Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint) self.videoVentana.resize(640, 480) self.listwidget = QListWidget() self.listwidget.clicked.connect(self.listclicked) self.playButton = QPushButton() self.playButton.setEnabled(True) self.playButton.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay)) self.playButton.clicked.connect(self.play) self.stopButton = QPushButton() self.stopButton.setEnabled(True) self.stopButton.setIcon(self.style().standardIcon(QStyle.SP_MediaStop)) self.stopButton.clicked.connect(self.stop) self.anadirButton = QPushButton() self.anadirButton.setEnabled(True) self.anadirButton.setText("+") self.anadirButton.setIcon(self.style().standardIcon( QStyle.SP_FileIcon)) self.anadirButton.clicked.connect(self.addFile) self.removeButton = QPushButton() self.removeButton.setEnabled(True) self.removeButton.setText("-") self.removeButton.setIcon(self.style().standardIcon( QStyle.SP_FileIcon)) self.removeButton.clicked.connect(self.removeFile) self.abrirListaButton = QPushButton() self.abrirListaButton.setEnabled(True) self.abrirListaButton.setText(" ") self.abrirListaButton.setIcon(self.style().standardIcon( QStyle.SP_FileDialogNewFolder)) self.abrirListaButton.clicked.connect(self.openList) self.guardarListaButton = QPushButton() self.guardarListaButton.setEnabled(True) self.guardarListaButton.setText(" ") self.guardarListaButton.setIcon(self.style().standardIcon( QStyle.SP_DialogSaveButton)) self.guardarListaButton.clicked.connect(self.saveList) self.quitarButton = QPushButton() self.quitarButton.setEnabled(True) self.quitarButton.setText("-") self.quitarButton.setIcon(self.style().standardIcon( QStyle.SP_FileIcon)) self.quitarButton.clicked.connect(self.removeFile) self.showPlayerButton = QPushButton() self.showPlayerButton.setEnabled(True) self.showPlayerButton.setText(self.strButtonShow) self.showPlayerButton.clicked.connect(self.showPlayer) self.maxButton = QPushButton() self.maxButton.setEnabled(True) self.maxButton.setText("Maximizar") self.maxButton.clicked.connect(self.maximizePlayer) self.minButton = QPushButton() self.minButton.setEnabled(True) self.minButton.setText("Normal") self.minButton.clicked.connect(self.minimizePlayer) self.screensButton = QPushButton() self.screensButton.setEnabled(True) self.screensButton.setText("Cambiar pantalla") self.screensButton.clicked.connect(self.elegirPantalla) self.sigScreenButton = QPushButton() self.sigScreenButton.setEnabled(True) self.sigScreenButton.setText(">") self.sigScreenButton.setIcon(self.style().standardIcon( QStyle.SP_ComputerIcon)) self.sigScreenButton.clicked.connect(self.sigPantalla) self.antScreenButton = QPushButton() self.antScreenButton.setEnabled(True) self.antScreenButton.setText("<") self.antScreenButton.setIcon(self.style().standardIcon( QStyle.SP_ComputerIcon)) self.antScreenButton.clicked.connect(self.antPantalla) self.lblMediaActual = QLabel() self.lblMediaActual.setText("Media actual: No seleccionado.") self.positionSlider = QSlider(Qt.Horizontal) self.positionSlider.setRange(0, 0) self.positionSlider.sliderMoved.connect(self.setPosition) self.errorLabel = QLabel() self.errorLabel.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) # Create a widget for window contents wid = QWidget(self) self.setCentralWidget(wid) # Create layouts to place inside widget #controlLayout = QHBoxLayout() controlLayout = QGridLayout() #controlLayout.setContentsMargins(0, 0, 0, 0) # row, col, rowspan, colspan# controlLayout.addWidget(self.maxButton, 0, 0, 1, 2) controlLayout.addWidget(self.minButton, 0, 2, 1, 2) controlLayout.addWidget(self.showPlayerButton, 0, 4, 1, 2) controlLayout.addWidget(self.screensButton, 0, 6, 1, 2) controlLayout.addWidget(self.positionSlider, 1, 0, 1, 8) controlLayout.addWidget(self.listwidget, 2, 0, 6, 4) controlLayout.addWidget(self.playButton, 2, 4, 1, 1) controlLayout.addWidget(self.stopButton, 3, 4, 1, 1) controlLayout.addWidget(self.anadirButton, 4, 4, 1, 1) controlLayout.addWidget(self.quitarButton, 4, 5, 1, 1) controlLayout.addWidget(self.lblMediaActual, 5, 4, 1, 4) controlLayout.addWidget(self.abrirListaButton, 2, 5, 1, 1) controlLayout.addWidget(self.sigScreenButton, 2, 7, 1, 1) controlLayout.addWidget(self.antScreenButton, 3, 7, 1, 1) controlLayout.addWidget(self.guardarListaButton, 3, 5, 1, 1) controlLayout.addWidget(self.errorLabel, 8, 0, 1, 8) layout = QVBoxLayout() layout.addLayout(controlLayout) #Eventos del reproductor self.videoVentana.mediaPlayer.stateChanged.connect( self.mediaStateChanged) self.videoVentana.mediaPlayer.positionChanged.connect( self.positionChanged) self.videoVentana.mediaPlayer.durationChanged.connect( self.durationChanged) self.videoVentana.mediaPlayer.error.connect(self.handleError) self.videoVentana.mediaPlayer.currentMediaChanged.connect( self.currentMediaChanged) # Set widget to contain window contents wid.setLayout(layout) #Server, receives commands to player self.server = Server(self.videoVentana) self.startServer()
def main(argv): options = optparse.OptionParser() options.add_option('-l', '--list_file', dest='list_file', help='list_file', default=None) opts, args = options.parse_args(argv) print('opts:%s' % (opts)) print('args:%s' % (args)) if len(args): options.print_help() return if not opts.list_file: options.print_help() return list_file = [] f = open(opts.list_file, 'r') for i in f: filepath = i.strip() if filepath: list_file.append(filepath) f.close() app = QApplication(argv) list_widget = QListWidget() for filepath in list_file: if not os.path.exists(filepath): continue bmp = get_image_data(filepath) data = bmp.data table = QTableWidget(bmp.height, bmp.width) font = QFont() font.setFamily("Calibri") font.setPointSize(6) table.setFont(font) table.setEditTriggers(QTableWidget.NoEditTriggers) table.verticalHeader().setVisible(False) table.horizontalHeader().setVisible(False) f = io.BytesIO(data) for h in range(0, bmp.height): for w in range(0, bmp.width): c = f.read(1) item = QTableWidgetItem() item.setText('%02x' % (ord(c))) item.setBackground(QBrush(QColor(ord(c), ord(c), ord(c)))) table.setItem(h, w, item) f.close() for c in range(0, bmp.width): table.setColumnWidth(c, 18) for r in range(0, bmp.height): table.setRowHeight(r, 18) item = QListWidgetItem(list_widget) item.setSizeHint(table.sizeHint()) list_widget.setItemWidget(item, table) item = QListWidgetItem(list_widget) image = QImage(data, bmp.width, bmp.height, QImage.Format_Grayscale8) pixmap = QPixmap.fromImage(image) widget = QWidget() layout = QVBoxLayout() label = QLabel() label.setText(filepath) layout.addWidget(label) label = QLabel() label.setPixmap(pixmap) layout.addWidget(label) widget.setLayout(layout) item.setSizeHint(widget.sizeHint()) list_widget.setItemWidget(item, widget) list_widget.show() app.exec_()
def __init__(self, theParent, theProject, isStatus): QWidget.__init__(self, theParent) self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theProject self.theTheme = theParent.theTheme if isStatus: self.theStatus = self.theProject.statusItems else: self.theStatus = self.theProject.importItems self.colData = [] self.colCounts = [] self.colChanged = False self.selColour = None self.iPx = self.theTheme.baseIconSize self.outerBox = QVBoxLayout() self.mainBox = QHBoxLayout() self.mainForm = QVBoxLayout() self.listBox = QListWidget() self.listBox.setDragDropMode(QAbstractItemView.InternalMove) self.listBox.itemSelectionChanged.connect(self._selectedItem) self.listBox.model().rowsMoved.connect(self._rowsMoved) for iName, iCol, nUse in self.theStatus: self._addItem(iName, iCol, iName, nUse) self.editName = QLineEdit() self.editName.setMaxLength(40) self.editName.setEnabled(False) self.newButton = QPushButton("New") self.delButton = QPushButton("Delete") self.saveButton = QPushButton("Save") self.colPixmap = QPixmap(self.iPx, self.iPx) self.colPixmap.fill(QColor(120, 120, 120)) self.colButton = QPushButton(QIcon(self.colPixmap), "Colour") self.colButton.setIconSize(self.colPixmap.rect().size()) self.newButton.clicked.connect(self._newItem) self.delButton.clicked.connect(self._delItem) self.saveButton.clicked.connect(self._saveItem) self.colButton.clicked.connect(self._selectColour) self.mainForm.addWidget(self.newButton) self.mainForm.addWidget(self.delButton) self.mainForm.addStretch(1) self.mainForm.addWidget(QLabel("<b>Name</b>")) self.mainForm.addWidget(self.editName) self.mainForm.addWidget(self.colButton) self.mainForm.addStretch(1) self.mainForm.addWidget(self.saveButton) self.mainBox.addWidget(self.listBox) self.mainBox.addLayout(self.mainForm) if isStatus: self.outerBox.addWidget(QLabel("<b>Novel File Status Levels</b>")) else: self.outerBox.addWidget( QLabel("<b>Note File Importance Levels</b>")) self.outerBox.addLayout(self.mainBox) self.setLayout(self.outerBox) return
def __init__(self, h5file, logging_instance, parent=None): super(H5PlotGUI, self).__init__(parent) self.logger = logging_instance self.figures = [] self.h5parm = lh5.h5parm(h5file) self.solset_labels = self.h5parm.getSolsetNames() self.solset = self.h5parm.getSolset('sol000') self.soltab_labels = self.solset.getSoltabNames() self.soltab = self.solset.getSoltab(self.soltab_labels[0]) self.stations = self.soltab.getValues()[1]['ant'] self.refant = 'CS001HBA0' self.wrapphase = True self.stcache = SoltabCache(self.soltab.getValues(), self.soltab.getAxesNames()) rvals, raxes = reorder_soltab(self.soltab) self.stcache.update(rvals, raxes) self.move(300, 300) self.setWindowTitle('H5Plot') self.solset_label = QLabel('SolSet: ') self.solset_picker = QComboBox() for l in self.solset_labels: self.solset_picker.addItem(l) self.solset_picker.activated.connect(self._solset_picker_event) self.soltab_label_y = QLabel('Plot ') self.soltab_label_x = QLabel(' vs ') self.soltab_picker = QComboBox() for l in self.soltab_labels: self.soltab_picker.addItem(l) self.soltab_picker.activated.connect(self._soltab_picker_event) self.axis_picker = QComboBox() self.axis_picker.addItems(['time', 'freq']) self.axis_picker.activated.connect(self._axis_picker_event) self.axis = 'time' self.refant_label = QLabel('Ref. Ant. ') self.refant_picker = QComboBox() self.refant_picker.addItems(self.stations) self.refant_picker.activated.connect(self._refant_picker_event) self.phasewrap_box = QCheckBox('Wrap Phases') self.phasewrap_box.setChecked(True) self.phasewrap_box.setEnabled(False) self.phasewrap_box.stateChanged.connect(self._phasewrap_event) self.plot_button = QPushButton('Plot') self.plot_button.clicked.connect(self._plot_button_event) self.station_picker = QListWidget() self.station_picker.addItems(self.stations) self.station_picker.setCurrentRow(0) plot_layout = QGridLayout() plot_layout.addWidget(self.soltab_label_y, 0, 0) plot_layout.addWidget(self.soltab_picker, 0, 1) plot_layout.addWidget(self.soltab_label_x, 0, 2) plot_layout.addWidget(self.axis_picker, 0, 3) plot_layout.addWidget(self.refant_label, 1, 0) plot_layout.addWidget(self.refant_picker, 1, 1) plot_layout.addWidget(self.phasewrap_box, 1, 3) layout = QFormLayout(self) layout.addRow(self.solset_label, self.solset_picker) layout.addRow(plot_layout) layout.addRow(self.plot_button) layout.addRow(self.station_picker)
def setup_ui(self): # self.setGeometry(10, 10, self.width, self.height) self.setWindowTitle(__file__) # колонка Выбирай параметр: inner_layout_1 = QVBoxLayout() inner_layout_1.addWidget(QLabel('Выбирай параметр:')) self.columns = QListWidget() inner_layout_1.addWidget(self.columns) button_open = QPushButton('Open') button_open.clicked.connect(self.open_files) inner_layout_1.addWidget(button_open) self.horizontalGroupBox = QGroupBox() self.horizontalGroupBox.setLayout(inner_layout_1) # колонка Ось Y vertical_lay_2 = QGridLayout() vertical_lay_2.addWidget(QLabel('Ось Y:'), 0, 0) self.axe_y = QListWidget() vertical_lay_2.addWidget(self.axe_y, 1, 0) button_add_to_y = QPushButton('Add to Y') button_add_to_y.clicked.connect(self.add_to_y, 2, 0) vertical_lay_2.addWidget(button_add_to_y) button_remove_y = QPushButton('Remove from Y') button_remove_y.clicked.connect(self.remove_y) vertical_lay_2.addWidget(button_remove_y, 3, 0) self.horizontalGroupBox_2 = QGroupBox() self.horizontalGroupBox_2.setLayout(vertical_lay_2) # колонка Ось X vertical_lay_3 = QGridLayout() vertical_lay_3.addWidget(QLabel('Ось X:'), 0, 0) self.axe_x = QListWidget() vertical_lay_3.addWidget(self.axe_x, 1, 0) button_add_to_x = QPushButton('Add to X') button_add_to_x.clicked.connect(self.add_to_x) vertical_lay_3.addWidget(button_add_to_x, 2, 0) button_remove_x = QPushButton('Remove from X') button_remove_x.clicked.connect(self.remove_x) vertical_lay_3.addWidget(button_remove_x, 3, 0) self.horizontalGroupBox_3 = QGroupBox() self.horizontalGroupBox_3.setLayout(vertical_lay_3) # колонка Ось Y2 vertical_lay_4 = QGridLayout() vertical_lay_4.addWidget(QLabel('Ось Y2:'), 0, 0) self.axe_y2 = QListWidget() vertical_lay_4.addWidget(self.axe_y2, 1, 0) button_add_to_y2 = QPushButton('Add to Y2') button_add_to_y2.clicked.connect(self.add_to_y2) vertical_lay_4.addWidget(button_add_to_y2, 2, 0) button_remove_y2 = QPushButton('Remove from Y2') button_remove_y2.clicked.connect(self.remove_y2) vertical_lay_4.addWidget(button_remove_y2, 3, 0) self.horizontalGroupBox_4 = QGroupBox() self.horizontalGroupBox_4.setLayout(vertical_lay_4) self.first_huge_lay = QHBoxLayout() self.first_huge_lay.addWidget(self.horizontalGroupBox) self.first_huge_lay.addWidget(self.horizontalGroupBox_2) self.first_huge_lay.addWidget(self.horizontalGroupBox_4) self.first_huge_lay.addWidget(self.horizontalGroupBox_3) self.first_huge_GroupBox = QGroupBox() self.first_huge_GroupBox.setLayout(self.first_huge_lay) second_vertical_lay = QGridLayout() second_vertical_lay.addWidget(QLabel('Количество данных:'), 0, 0) self.number_point = QLabel() second_vertical_lay.addWidget(self.number_point, 0, 1) button_load_data = QPushButton('Загрузить данные') button_load_data.clicked.connect(self.load_data) second_vertical_lay.addWidget(button_load_data, 0, 2) second_vertical_lay.addWidget( QLabel('Количество отображаемых данных:'), 3, 0) self.number_point_grath = QLabel() second_vertical_lay.addWidget(self.number_point_grath, 3, 1) list_dot = ['1', '10', '100', '1000', '10000'] self.combobox_dot = QComboBox() self.combobox_dot.addItems(list_dot) self.combobox_dot.setCurrentIndex(1) second_vertical_lay.addWidget(self.combobox_dot, 2, 0) button_grath = QPushButton('Построить графики') button_grath.clicked.connect(self.plot_grath) second_vertical_lay.addWidget(button_grath, 2, 1) self.horizontal_2_GroupBox = QGroupBox() self.horizontal_2_GroupBox.setLayout(second_vertical_lay) windowLayout = QVBoxLayout() windowLayout.addWidget(self.first_huge_GroupBox) windowLayout.addWidget(self.horizontal_2_GroupBox) self.setLayout(windowLayout) self.show()
def create_gui(self): """ Yep, creates the GUI. """ total_cats = len(self.categories) btn_height, btn_width = 70, self.width / total_cats self.btns = [0] * total_cats # add the category - movies and sports - buttons for i in range(0, total_cats): self.btns[i] = QPushButton(self.categories[i], self) self.btns[i].clicked.connect(self.update_list) self.btns[i].setGeometry(i * btn_width, 0, btn_width, btn_height) # add the side bar that containes use-cases list_width, list_height = 200, 300 self.list = QListWidget(self) self.list.clicked.connect(self.process_use_case) self.list.setGeometry(0, btn_height, list_width, list_height) # add more buttons self.file_btn = QPushButton("Choose file", self) self.file_btn.clicked.connect(self.set_file) self.file_btn.setGeometry(0, list_height + btn_height, list_width, self.height - (list_height + btn_height)) op_btn_height = (self.height - (list_height + btn_height)) / 2 op_btn_width = list_width * 3 / 4 op_btn1 = QPushButton("Find FabBits", self) op_btn1.clicked.connect(self.find_fabbits) op_btn1.setGeometry(self.width - list_width * 3 / 4, list_height + btn_height, op_btn_width, op_btn_height) op_btn2 = QPushButton("Save FabBits", self) op_btn2.clicked.connect(self.save_fabbits) op_btn2.setGeometry(self.width - list_width * 3 / 4, list_height + btn_height + op_btn_height, op_btn_width, op_btn_height) self.status_bar = QPlainTextEdit(self) self.status_bar.setReadOnly(True) self.status_bar.setGeometry(list_width, list_height + btn_height, self.width - list_width - op_btn_width, 2 * op_btn_height) self.original_stream = sys.stdout play_button_h, play_button_w = 30, 30 vw = QVideoWidget(self) vw.setGeometry( list_width, btn_height, self.width - list_width, self.height - btn_height - 2 * op_btn_height - play_button_h) self.media_player = QMediaPlayer(None, QMediaPlayer.VideoSurface) self.media_player.setVideoOutput(vw) self.media_player.stateChanged.connect(self.state_change) self.media_player.positionChanged.connect(self.set_pos_player) self.media_player.durationChanged.connect(self.set_duration) self.vid_button = QPushButton(self) self.vid_button.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay)) self.vid_button.clicked.connect(self.play_vid) self.vid_button.setEnabled(False) self.vid_button.setGeometry( list_width, self.height - 2 * op_btn_height - play_button_h, play_button_w, play_button_h) self.vid_slider = QSlider(QtCore.Qt.Horizontal, self) self.vid_slider.sliderMoved.connect(self.set_pos_slider) self.stylesheet = """ QSlider::handle { background: qlineargradient( x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f ); border: 1px solid #5c5c5c; width : 10px; margin : -2px 0; border-radius : 3px; } QSlider::groove { background : black; } """ self.vid_slider.setStyleSheet(self.stylesheet) self.vid_slider.setGeometry( list_width + play_button_w, self.height - 2 * op_btn_height - play_button_h, self.width + list_width - play_button_w, play_button_h) self.update_list("MOVIES") self.setWindowTitle('FabBits') self.setFixedSize(self.width, self.height) self.show()
def init_gui(self): self.setWindowTitle("Coordinate control") self.layout = QGridLayout() self.setMinimumSize(1250,1000) self.setLayout(self.layout) self.image_mask_stack = QTabWidget() #---------------------------ROIs win---------------------------------- self.selection_view = DrawingWidget(self) self.selection_view.setMinimumWidth(900) self.selection_view.enable_drawing(True) # self.selection_view.getView().setLimits(xMin = 0, xMax = 2048, yMin = 0, yMax = 2048, \ # minXRange = 2048, minYRange = 2048, maxXRange = 2048, maxYRange = 2048) self.selection_view.ui.roiBtn.hide() self.selection_view.ui.menuBtn.hide() self.selection_view.ui.normGroup.hide() self.selection_view.ui.roiPlot.hide() # self.selection_view.setImage(plt.imread('CoordinatesManager/Registration_Images/StageRegistration/Distance200_Offset0/A1.png')) #---------------------------Mask win---------------------------------- self.mask_view = SquareImageView() self.mask_view.getView().setLimits(xMin = 0, xMax = 2048, yMin = 0, yMax = 2048, \ minXRange = 2048, minYRange = 2048, maxXRange = 2048, maxYRange = 2048) self.mask_view.ui.roiBtn.hide() self.mask_view.ui.menuBtn.hide() self.mask_view.ui.normGroup.hide() self.mask_view.ui.roiPlot.hide() self.mask_view.ui.histogram.hide() #-------------------------MAsk RCNN----------------------------------- MLmaskviewBox = QWidget() MLmaskviewBoxLayout = QGridLayout() self.Matdisplay_Figure = Figure() self.Matdisplay_Canvas = FigureCanvas(self.Matdisplay_Figure) # self.Matdisplay_Canvas.setFixedWidth(900) # self.Matdisplay_Canvas.setFixedHeight(900) self.Matdisplay_Canvas.mpl_connect('button_press_event', self._onclick) self.Matdisplay_toolbar = NavigationToolbar(self.Matdisplay_Canvas, self) MLmaskviewBoxLayout.addWidget(self.Matdisplay_toolbar, 0, 0) MLmaskviewBoxLayout.addWidget(self.Matdisplay_Canvas, 1, 0) MLmaskviewBox.setLayout(MLmaskviewBoxLayout) self.image_mask_stack.addTab(self.selection_view, 'Select') self.image_mask_stack.addTab(self.mask_view, 'Mask') self.image_mask_stack.addTab(MLmaskviewBox, 'Mask-RCNN') self.layout.addWidget(self.image_mask_stack, 0, 0, 4, 7) # ---------------------- Mask generation Container -------------- self.maskGeneratorContainer = roundQGroupBox() self.maskGeneratorContainer.setFixedSize(320, 220) self.maskGeneratorContainer.setTitle("Mask generator") self.maskGeneratorContainerLayout = QGridLayout() self.maskGeneratorLayout = QGridLayout() self.maskGeneratorContainer.setLayout(self.maskGeneratorContainerLayout) # self.loadMaskFromFileButton = QPushButton('Load mask') # self.loadMaskFromFileButton.clicked.connect(self.load_mask_from_file) self.addRoiButton = QPushButton("Add ROI") self.createMaskButton = QPushButton("Add mask") self.deleteMaskButton = QPushButton("Delete mask") self.removeSelectionButton = cleanButton() self.removeSelectionButton.setFixedHeight(25) self.removeSelectionButton.setToolTip("Remove rois and output signals") self.addRoiButton.clicked.connect(self.add_polygon_roi) self.createMaskButton.clicked.connect(self.create_mask) self.deleteMaskButton.clicked.connect(self.delete_mask) self.removeSelectionButton.clicked.connect(self.remove_selection) self.maskGeneratorContainerLayout.addWidget(self.addRoiButton, 0, 0) self.maskGeneratorContainerLayout.addWidget(self.createMaskButton, 2, 1) self.maskGeneratorContainerLayout.addWidget(self.deleteMaskButton, 2, 2) self.maskGeneratorContainerLayout.addWidget(self.removeSelectionButton, 2, 3) # self.maskGeneratorContainerLayout.addWidget(self.loadMaskFromFileButton, 2, 1) self.clearRoiButton = QPushButton("Clear ROI") self.clearRoiButton.clicked.connect(lambda: self.selection_view.clear_rois()) self.maskGeneratorContainerLayout.addWidget(self.clearRoiButton, 0, 1) self.maskGeneratorContainerLayout.addWidget(QLabel("Mask index:"), 1, 0) self.mask_index_spinbox = QSpinBox() self.mask_index_spinbox.setMinimum(1) self.mask_index_spinbox.setValue(1) self.maskGeneratorContainerLayout.addWidget(self.mask_index_spinbox, 1, 1) self.previous_mask_button = QPushButton() self.previous_mask_button.setStyleSheet("QPushButton {color:white;background-color: #FFCCE5;}" "QPushButton:hover:!pressed {color:white;background-color: #CCFFFF;}") self.previous_mask_button.setToolTip("Click arrow to enable WASD keyboard control") self.previous_mask_button.setFixedWidth(60) self.previous_mask_button.setIcon(QIcon('./Icons/LeftArrow.png')) self.previous_mask_button.clicked.connect(lambda: self.show_mask_with_index(-1)) self.maskGeneratorContainerLayout.addWidget(self.previous_mask_button, 1, 2) self.next_mask_button = QPushButton() self.next_mask_button.setStyleSheet("QPushButton {color:white;background-color: #FFCCE5;}" "QPushButton:hover:!pressed {color:white;background-color: #CCFFFF;}") self.next_mask_button.setToolTip("Click arrow to enable WASD keyboard control") self.next_mask_button.setFixedWidth(60) self.next_mask_button.setIcon(QIcon('./Icons/RightArrow.png')) self.next_mask_button.clicked.connect(lambda: self.show_mask_with_index(1)) self.maskGeneratorContainerLayout.addWidget(self.next_mask_button, 1, 3) self.selectionOptionsContainer = roundQGroupBox() self.selectionOptionsContainer.setTitle('Options') self.selectionOptionsLayout = QGridLayout() self.fillContourButton = QCheckBox() self.invertMaskButton = QCheckBox() self.thicknessSpinBox = QSpinBox() self.thicknessSpinBox.setRange(1, 25) self.selectionOptionsLayout.addWidget(QLabel('Fill contour:'), 0, 0) self.selectionOptionsLayout.addWidget(self.fillContourButton, 0, 1) self.selectionOptionsLayout.addWidget(QLabel('Invert mask:'), 1, 0) self.selectionOptionsLayout.addWidget(self.invertMaskButton, 1, 1) self.selectionOptionsLayout.addWidget(QLabel('Thickness:'), 2, 0) self.selectionOptionsLayout.addWidget(self.thicknessSpinBox, 2, 1) lasers = ['640', '532', '488'] self.transform_for_laser_menu = QListWidget() self.transform_for_laser_menu.addItems(lasers) self.transform_for_laser_menu.setFixedHeight(48) self.transform_for_laser_menu.setFixedWidth(65) self.transform_for_laser_menu.setCurrentRow(0) self.selectionOptionsLayout.addWidget(QLabel('To be used with laser:'), 0, 2) self.selectionOptionsLayout.addWidget(self.transform_for_laser_menu, 1, 2) self.selectionOptionsContainer.setLayout(self.selectionOptionsLayout) self.maskGeneratorContainerLayout.addWidget(self.selectionOptionsContainer, 3, 0, 2, 3) #----------------------------Mask-RCNN-------------------------------- self.MLOptionsContainer = roundQGroupBox() self.MLOptionsContainer.setTitle('Mask-RCNN') self.MLOptionsContainerLayout = QGridLayout() self.init_ML_button = QPushButton('Init. ML', self) self.MLOptionsContainerLayout.addWidget(self.init_ML_button, 0, 0) self.init_ML_button.clicked.connect(lambda: self.run_in_thread(self.init_ML)) self.run_ML_button = QPushButton('Analysis', self) self.MLOptionsContainerLayout.addWidget(self.run_ML_button, 1, 0) self.run_ML_button.clicked.connect(self.run_ML_onImg_and_display) self.generate_MLmask_button = QPushButton('To ROIs', self) self.MLOptionsContainerLayout.addWidget(self.generate_MLmask_button, 2, 0) self.generate_MLmask_button.clicked.connect(lambda: self.run_in_thread(self.generate_MLmask)) self.MLOptionsContainer.setLayout(self.MLOptionsContainerLayout) self.maskGeneratorContainerLayout.addWidget(self.MLOptionsContainer, 3, 3, 2, 1) self.layout.addWidget(self.maskGeneratorContainer, 0, 8, 1, 3) self.DMDWidget = DMDWidget.DMDWidget() self.layout.addWidget(self.DMDWidget, 1, 8, 1, 3) """-------------------------------------------------------------------- # Singal sent out from DMDWidget to ask for mask generated here. # And then the generated roi list is sent back to function:receive_mask_coordinates in DMDWidget. # -------------------------------------------------------------------- """ self.DMDWidget.sig_request_mask_coordinates.connect(lambda: self.cast_mask_coordinates('dmd')) self.sig_cast_mask_coordinates_to_dmd.connect(self.DMDWidget.receive_mask_coordinates) self.DMDWidget.sig_start_registration.connect(lambda: self.sig_start_registration.emit()) self.DMDWidget.sig_finished_registration.connect(lambda: self.sig_finished_registration.emit()) #---------------------------Galvo control----------------------------- self.GalvoWidget = GalvoWidget.GalvoWidget() self.GalvoWidget.setFixedWidth(200) self.GalvoWidget.setFixedHeight(180) self.layout.addWidget(self.GalvoWidget, 2, 8, 2, 1) self.GalvoWidget.sig_request_mask_coordinates.connect(lambda: self.cast_mask_coordinates('galvo')) self.sig_cast_mask_coordinates_to_galvo.connect(self.GalvoWidget.receive_mask_coordinates) self.GalvoWidget.sig_start_registration.connect(lambda: self.sig_start_registration.emit()) self.GalvoWidget.sig_finished_registration.connect(lambda: self.sig_finished_registration.emit()) #-------------------------Manual registration------------------------- self.ManualRegistrationWidget = ManualRegistration.ManualRegistrationWidget() self.ManualRegistrationWidget.setFixedWidth(100) self.ManualRegistrationWidget.sig_request_camera_image.connect(self.cast_camera_image) self.sig_cast_camera_image.connect(self.ManualRegistrationWidget.receive_camera_image) self.layout.addWidget(self.ManualRegistrationWidget, 2, 9, 1, 1) #-------------------------Stage collect------------------------------- self.StageRegistrationWidget = StageRegistrationWidget.StageWidget() self.StageRegistrationWidget.setFixedWidth(100) self.layout.addWidget(self.StageRegistrationWidget, 3, 9, 1, 1)
def __init__(self, parent=None, ROOTDIR=''): super(GuiTabDetectLeads, self).__init__(parent) self.selected_subj_ANT = '' # General settings/variables/helper files needed needed at some point if not ROOTDIR: from dependencies import ROOTDIR self.cfg = HF.LittleHelpers.load_config( ROOTDIR) # load configuration file/options from file if os.path.isdir(self.cfg["folders"]["nifti"]): self.niftidir = self.cfg["folders"]["nifti"] else: self.niftidir = os.getcwd() self.cfg["folders"]["rootdir"] = ROOTDIR HF.LittleHelpers.save_config(ROOTDIR, self.cfg) self.lay = QHBoxLayout(self) self.tab = QWidget() # Customize tab # ============================== Tab 3 - Lead detection routines ============================== self.tab.layout = QHBoxLayout() self.tab.setLayout(self.tab.layout) # ------------------------- Upper left part (Folder) ------------------------- # self.FolderboxTab = QGroupBox("Directory (Bugra-Files)") self.HBoxUpperLeftTab = QVBoxLayout(self.FolderboxTab) self.lblWdirTab = QLabel('wDIR: {}'.format(self.niftidir)) self.HBoxUpperLeftTab.addWidget(self.lblWdirTab) #TODO: is it possible to summarize the working directoy ? If the path is too long the list of available subjects gets too small self.btnChangeWdir = QPushButton('Change working directory') self.btnChangeWdir.clicked.connect(self.change_wdir) #if changing folder is canceled, the whole script shuts down (macOS Catalina) self.btnReloadFilesTab = QPushButton('Reload files') self.btnReloadFilesTab.clicked.connect(self.run_reload_files) self.HBoxUpperLeftTab.addWidget(self.btnChangeWdir) self.HBoxUpperLeftTab.addWidget(self.btnReloadFilesTab) # ------------------------- Middle left part (Settings) ------------------------- # self.SettingsTabLeadDetect = QGroupBox("Preferences") self.HBoxMiddleLeftTabExt = QVBoxLayout(self.SettingsTabLeadDetect) self.btn_LeadDetectSettings = QPushButton('Settings \nLead detection') self.btn_LeadDetectSettings.clicked.connect( self.run_PreferencesLeadDetection) self.btn_LeadDetectSettings.setToolTip(setToolTips.ANTsSettings()) self.HBoxMiddleLeftTabExt.addWidget(self.btn_LeadDetectSettings) # ------------------------- Middle left part (Processing) ------------------------- # self.ActionsTabANTs = QGroupBox("Lead detection routines") self.HBoxMiddleLeftTab = QVBoxLayout(self.ActionsTabANTs) self.btn_LeadDetectPacer = QPushButton('PaCER algorithm') self.btn_LeadDetectPacer.clicked.connect(self.run_LeadDetectionPaCER) self.btn_RefineDetectedLeads = QPushButton('Refine detected leads') self.btn_RefineDetectedLeads.clicked.connect(self.run_ManualCorrection) self.HBoxMiddleLeftTab.addWidget(self.btn_LeadDetectPacer) self.HBoxMiddleLeftTab.addWidget(self.btn_RefineDetectedLeads) # ------------------------- Lower left part (Processing) ------------------------- # self.QualityTabLeadDetect = QGroupBox( "Quality checks for Lead detection") self.HBoxLowerLeftTab = QVBoxLayout(self.QualityTabLeadDetect) self.btn_QC_LeadDetect = QPushButton( 'Check lead detection \nin viewer') self.btn_QC_LeadDetect.setToolTip(setToolTips.compareNIFTIfiles()) self.btn_QC_LeadDetect.clicked.connect(self.VisualiseLeadDetection) self.HBoxLowerLeftTab.addWidget(self.btn_QC_LeadDetect) # self.HBoxLowerLeftTab.addWidget(self.btn_RegQC) #TODO: whatsoever (?); accurate #TODO: view available (...); in tooltips correction instaed of correcion #TODO: additionally.view available in General -> tooltips: subject instead of just subj # -------------------- Right part (Subject list) ----------------------- # self.listbox = QGroupBox('Available subjects') self.HBoxUpperRightTab = QVBoxLayout(self.listbox) self.availableNiftiTab = QListWidget() self.availableNiftiTab.setSelectionMode( QAbstractItemView.ExtendedSelection) itemsTab = HF.list_folders(self.niftidir, prefix=self.cfg["folders"]["prefix"]) self.add_available_items(self.availableNiftiTab, itemsTab, msg='no') self.availableNiftiTab.itemSelectionChanged.connect( self.change_list_item) self.HBoxUpperRightTab.addWidget(self.availableNiftiTab) # Combine all Boxes for Tab 2 Layout self.LeftboxTabANTs = QGroupBox() self.HBoxTabLeadDetectLeft = QVBoxLayout(self.LeftboxTabANTs) self.HBoxTabLeadDetectLeft.addWidget(self.FolderboxTab) self.HBoxTabLeadDetectLeft.addStretch(1) self.HBoxTabLeadDetectLeft.addWidget(self.SettingsTabLeadDetect) self.HBoxTabLeadDetectLeft.addWidget(self.ActionsTabANTs) self.HBoxTabLeadDetectLeft.addWidget(self.QualityTabLeadDetect) self.tab.layout.addWidget(self.LeftboxTabANTs) self.tab.layout.addWidget(self.listbox) self.lay.addWidget(self.tab)
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) #Label_Min self.label_min = QLabel(self) self.label_min.setText("Minimum") self.label_min.move(20, 20) #Textbox_Min self.textbox_min = QLineEdit(self) self.textbox_min.move(20, 40) self.textbox_min.resize(60, 20) #Label_Depth self.label_depth = QLabel(self) self.label_depth.setText("Depth") self.label_depth.move(20, 80) #Textbox_Depth self.comb_depth = QComboBox(self) self.comb_depth.addItems([ "1 - None", "2 - cluster-, jewels, maps, watchstones", "3 - heist-util, abyss-jewels", "4 - without implicit", "5 - with implicit", "6 - none" ]) self.comb_depth.currentIndexChanged.connect(self.selectionchange) self.comb_depth.move(20, 100) self.comb_depth.resize(280, 20) #Label_Mod self.label_mod = QLabel(self) self.label_mod.setText("Desired Mod") self.label_mod.move(20, 140) #Textbox_Mod self.textbox_mod = QLineEdit(self) self.textbox_mod.move(20, 160) self.textbox_mod.resize(280, 20) #Label_Modlist self.label_modlist = QLabel(self) self.label_modlist.setText("Modlist") self.label_modlist.move(20, 200) #Textbox_Modlist self.modlist = QListWidget(self) self.modlist.move(20, 220) self.modlist.resize(280, 300) #Save Button self.button = QPushButton('Save Mod', self) self.button.move(20, 550) self.button.resize(70, 50) self.button.setStyleSheet("background-color : rgba(0, 255, 0, 50%)") self.button.clicked.connect(self.on_click_save) #Delete Button self.button_del = QPushButton('Delete Mod', self) self.button_del.move(230, 550) self.button_del.resize(70, 50) self.button_del.setStyleSheet( "background-color : rgba(255, 0, 0, 50%)") self.button_del.clicked.connect(self.on_click_del) self.textbox_min.setText("50") self.textbox_mod.setText("to maximum Life") #Pushbutton self.pushbutton = QPushButton("Activate Listener", self) self.pushbutton.setGeometry(200, 150, 100, 40) self.pushbutton.setCheckable(True) self.pushbutton.clicked.connect(self.changeState) self.pushbutton.setStyleSheet("background-color : lightgrey") self.pushbutton.move(110, 620) self.update() self.show()
def init(self): self.midiList = QListWidget() self.midiDict = {} self.flushMidiList()
def __init__(self, parent=None): """Dialogs that allows users to load music libraries. A list of libraries is listed in a ListWidget on the left with the library module's InitWidget shown on the right. First all libraries stored in puddlestuff.libraries are loaded. Then puddlestuff.musiclib.extralibs is checked for an extra libraries. They should already be loaded. Useful methods: loadLib()->Loads the currently selected library. loadLibConfig() Libraries are module which should contain the following: name->The name of the library. InitWidget class->Used to allow the use to set options required for loading the library. """ QDialog.__init__(self, parent) self.listbox = QListWidget() self.setWindowTitle(translate('MusicLib', 'Import Music Library')) winsettings('importmusiclib', self) self.libattrs = [] for libname in libraries.__all__: try: lib = __import__('puddlestuff.libraries.%s' % libname, fromlist=['puddlestuff', 'libraries']) if not hasattr(lib, 'InitWidget'): raise Exception(translate('MusicLib', 'Invalid library')) except Exception as detail: msg = translate('MusicLib', 'Error loading %1: %2\n') msg = msg.arg(libname).arg(str(detail)) sys.stderr.write(msg) continue try: name = lib.name except AttributeError: name = translate('MusicLib', 'Anonymous Library') try: desc = lib.description except AttributeError: desc = translate('MusicLib', 'Description was left out.') try: author = lib.author except AttributeError: author = translate('MusicLib', 'Anonymous author.') self.libattrs.append({ 'name': name, 'desc': desc, 'author': author, 'module': lib }) self.libattrs.extend(extralibs) if not self.libattrs: raise MusicLibError(0, errors[0]) self.listbox.addItems([z['name'] for z in self.libattrs]) self.stackwidgets = [z['module'].InitWidget() for z in self.libattrs] self.listbox.currentRowChanged.connect(self.changeWidget) okcancel = OKCancel() okcancel.ok.connect(self.loadLib) okcancel.cancel.connect(self.close) self.stack = QStackedWidget() self.stack.setFrameStyle(QFrame.Box) list(map(self.stack.addWidget, self.stackwidgets)) hbox = QHBoxLayout() hbox.addWidget(self.listbox, 0) hbox.addWidget(self.stack, 1) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addLayout(okcancel) self.setLayout(vbox)
def init_ui(self): self.setFont(QFont('Segoe UI')) grid_layout = QGridLayout() grid_layout.setSpacing(10) self.setGeometry(0, 0, 385, 750) qtRectangle = self.frameGeometry() screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos()) centerPoint = QApplication.desktop().screenGeometry(screen).center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) menu_bar = self.menuBar() file_menu = menu_bar.addMenu('File') plot_menu = menu_bar.addMenu('Plots') create_new_db = QAction('Create Database', self) create_new_db.triggered.connect(self.create_database) file_menu.addAction(create_new_db) self.create_plots = QAction('View Plots', self) self.create_plots.triggered.connect(self.generate_plots) plot_menu.addAction(self.create_plots) self.create_plots.setDisabled(True) self.setWindowTitle('Nutrient Stock Standard Tracker') database_path_label = QLabel('Path to Database File:') self.database_path_field = QLineEdit() database_browse = QPushButton('Browse') database_browse.clicked.connect(self.path_browse) linesep1 = QFrame() linesep1.setFrameShape(QFrame.HLine) linesep1.setFrameShadow(QFrame.Sunken) past_entries_label = QLabel('Previous Entries: ') self.standard_entries = QListWidget() self.view_entry = QPushButton('View') self.view_entry.clicked.connect(self.view_existing) self.new_entry = QPushButton('New') self.new_entry.clicked.connect(self.enter_new) self.new_entry.setDisabled(True) grid_layout.addWidget(database_path_label, 0, 0, 1, 2) grid_layout.addWidget(self.database_path_field, 1, 0, 1, 2) grid_layout.addWidget(database_browse, 2, 1, 1, 1) grid_layout.addWidget(linesep1, 3, 0, 1, 2) grid_layout.addWidget(past_entries_label, 4, 0, 1, 2) grid_layout.addWidget(self.standard_entries, 5, 0, 8, 2) grid_layout.addWidget(self.view_entry, 13, 0, 1, 2) grid_layout.addWidget(self.new_entry, 14, 0, 1, 2) self.centralWidget().setLayout(grid_layout) appdata_path = os.getenv('LOCALAPPDATA') if os.path.isdir(appdata_path + '/' + 'Stocks Tracker'): if os.path.isfile(appdata_path + '/' + 'Stocks Tracker' + '/' + 'path_memory.txt'): with open(appdata_path + '/' + 'Stocks Tracker' + '/' + 'path_memory.txt', 'r') as file: remembered_path = file.read() self.database_path_field.setText(remembered_path) self.populate_list() else: os.mkdir(appdata_path + '/' + 'Stocks Tracker') with open(appdata_path + '/' + 'Stocks Tracker' + '/' + 'path_memory.txt', 'w+') as file: pass self.show()
def init_ui(self): self.setFont(QFont('Segoe UI')) self.setGeometry(0, 0, 780, 820) qtRectangle = self.frameGeometry() centerPoint = QDesktopWidget().availableGeometry().center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) self.setWindowTitle('HyPro - Plotting Window') self.qvbox_layout = QVBoxLayout() self.qvbox_frame_holder = QFrame() self.qvbox_frame_holder.setLayout(self.qvbox_layout) self.grid_layout = QGridLayout() self.main_menu = self.menuBar() self.file_menu = self.main_menu.addMenu('File') self.edit_menu = self.main_menu.addMenu('Edit') export = QAction(QIcon(':/assets/archivebox.svg'), 'Export Plot', self) export.triggered.connect(self.export_plot) self.file_menu.addAction(export) copy = QAction(QIcon(':/assets/newdoc.svg'), 'Copy', self) copy.triggered.connect(self.copy_plot) self.edit_menu.addAction(copy) self.run_list_label = QLabel('Select Run:', self) self.run_list = QListWidget(self) self.run_list.setSelectionMode(QAbstractItemView.ExtendedSelection) self.run_list.setMaximumWidth(120) self.show_bad_data = QCheckBox('Show bad data', self) self.mark_bad_data = QCheckBox('Mark bad data', self) self.apply_button = QPushButton('Apply', self) self.figure = plt.figure() self.figure.set_tight_layout(tight=True) self.canvas = FigureCanvas(self.figure) self.canvas.setParent(self) self.main_plot = self.figure.add_subplot(111) for x in self.main_plot.get_xticklabels(): x.set_fontsize(12) for y in self.main_plot.get_yticklabels(): y.set_fontsize(12) self.grid_layout.addWidget(self.canvas, 0, 1) self.grid_layout.addWidget(self.qvbox_frame_holder, 0, 0) self.qvbox_layout.addWidget(self.run_list_label) self.qvbox_layout.addWidget(self.run_list) self.qvbox_layout.addWidget(self.show_bad_data) self.qvbox_layout.addWidget(self.mark_bad_data) self.qvbox_layout.addWidget(self.apply_button) self.centralWidget().setLayout(self.grid_layout)
self.item_list = item_list def act(self, msg, tell, create): msg_type = msg['type'] if msg_type == 'new-todo': title = msg['body']['title'] QListWidgetItem(title, self.item_list) app = QApplication([]) window = QWidget() layout = QVBoxLayout() get = QPushButton('Fetch Item') item_list = QListWidget() system = spot.system.ActorSystem(app) system.create_actor(Counter(), 'counter') system.create_actor(DB(), 'db') system.create_actor(Fetcher(), 'fetcher') system.create_actor(Receiver(), 'receiver') system.create_actor(ItemList(item_list), 'item-list') get.clicked.connect(lambda: system.tell('counter', "click!")) layout.addWidget(get) layout.addWidget(item_list) window.setLayout(layout) window.show() app.exec_()
def showDialog(self, currentCard=None): if currentCard: self.did = currentCard.did elif mw._selectedDeck(): self.did = mw._selectedDeck()['id'] else: return if not self._getCardInfo(self.did): showInfo('Please select an Incremental Reading deck.') return dialog = QDialog(mw) layout = QVBoxLayout() self.cardListWidget = QListWidget() self.cardListWidget.setAlternatingRowColors(True) self.cardListWidget.setSelectionMode( QAbstractItemView.ExtendedSelection) self.cardListWidget.setWordWrap(True) self.cardListWidget.itemDoubleClicked.connect(lambda: showBrowser( self.cardListWidget.currentItem().data(Qt.UserRole)['nid'])) self._updateListItems() upButton = QPushButton('Up') upButton.clicked.connect(self._moveUp) downButton = QPushButton('Down') downButton.clicked.connect(self._moveDown) topButton = QPushButton('Top') topButton.clicked.connect(self._moveToTop) bottomButton = QPushButton('Bottom') bottomButton.clicked.connect(self._moveToBottom) randomizeButton = QPushButton('Randomize') randomizeButton.clicked.connect(self._randomize) controlsLayout = QHBoxLayout() controlsLayout.addWidget(topButton) controlsLayout.addWidget(upButton) controlsLayout.addWidget(downButton) controlsLayout.addWidget(bottomButton) controlsLayout.addStretch() controlsLayout.addWidget(randomizeButton) buttonBox = QDialogButtonBox(QDialogButtonBox.Close | QDialogButtonBox.Save) buttonBox.accepted.connect(dialog.accept) buttonBox.rejected.connect(dialog.reject) buttonBox.setOrientation(Qt.Horizontal) layout.addLayout(controlsLayout) layout.addWidget(self.cardListWidget) layout.addWidget(buttonBox) dialog.setLayout(layout) dialog.setWindowModality(Qt.WindowModal) dialog.resize(500, 500) choice = dialog.exec_() if choice == 1: cids = [] for i in range(self.cardListWidget.count()): card = self.cardListWidget.item(i).data(Qt.UserRole) cids.append(card['id']) self.reorder(cids)
def init_ui(self): """Layout and main functionalities""" # Labels qc_label = QLabel("QC procedures") reset_label = QLabel("Reset QC: ") to_label = QLabel("->") bad_range_label = QLabel("- Bad QC: ") bad_flat_label = QLabel("- Bad QC: ") bad_spike_label = QLabel("- Bad QC: ") rolling_label = QLabel("Rolling window: ") threshold_label = QLabel("Threshold: ") parameter_label = QLabel("Parameters: ") # Lists self.key_list = QListWidget(self) self.key_list.setEnabled(False) # Check Box self.reset_check = QCheckBox("Reset QC", self) self.reset_check.setChecked(True) self.range_check = QCheckBox("Range test", self) self.range_check.setChecked(True) self.flat_check = QCheckBox("Flat test", self) self.flat_check.setChecked(True) self.spike_check = QCheckBox("Spike test", self) self.spike_check.setChecked(True) self.flag2flag_check = QCheckBox("Change flags", self) self.flag2flag_check.setChecked(True) self.all_check = QCheckBox("All", self) self.all_check.setChecked(True) self.all_check.toggled.connect(self.key_list.setDisabled) # Spin box self.original_spin_box = QSpinBox(self) self.original_spin_box.setMinimum(0) self.original_spin_box.setMaximum(9) self.original_spin_box.setValue(0) # - self.translated_spin_box = QSpinBox(self) self.translated_spin_box.setMinimum(0) self.translated_spin_box.setMaximum(9) self.translated_spin_box.setValue(1) # - self.bad_range_spin_box = QSpinBox(self) self.bad_range_spin_box.setMinimum(0) self.bad_range_spin_box.setMaximum(9) self.bad_range_spin_box.setMinimum(0) self.bad_range_spin_box.setValue(4) # - self.flat_spin_box = QSpinBox(self) self.flat_spin_box.setMinimum(0) self.flat_spin_box.setMaximum(9) self.flat_spin_box.setMinimum(0) self.flat_spin_box.setValue(4) # - self.spike_spin_box = QSpinBox(self) self.spike_spin_box.setMinimum(0) self.spike_spin_box.setMaximum(9) self.spike_spin_box.setMinimum(0) self.spike_spin_box.setValue(4) # - self.rolling_spin_box = QSpinBox(self) self.rolling_spin_box.setValue(0) self.rolling_spin_box.setToolTip( "Size of the moving window.\n" "This is the number of observations used for calculating" " the mean.\n0 = Auto") # - self.reset_spin_box = QSpinBox(self) self.reset_spin_box.setMinimum(0) self.reset_spin_box.setMaximum(9) self.reset_spin_box.setMinimum(0) self.reset_spin_box.setValue(0) # - self.threshold_spin_box = QDoubleSpinBox(self) self.threshold_spin_box.setValue(2.00) self.threshold_spin_box.setToolTip( "Maximum difference between the value analyzed and the average of" " the rolling window.") # Button apply_button = QPushButton("Apply") apply_button.clicked.connect(self.apply) close_button = QPushButton("Hide") close_button.clicked.connect(self.hide) # Layouts # - Horizontal Layout for reset h_reset = QHBoxLayout() h_reset.addWidget(reset_label) h_reset.addWidget(self.reset_spin_box) h_reset.addStretch() # - Horizontal Layout for ranges h_ranges = QHBoxLayout() h_ranges.addWidget(bad_range_label) h_ranges.addWidget(self.bad_range_spin_box) h_ranges.addStretch() # h_ranges.addStretch() # - Horizontal Layout for flat h_flat = QHBoxLayout() h_flat.addWidget(bad_flat_label) h_flat.addWidget(self.flat_spin_box) h_flat.addStretch() # h_flat.addStretch() # - Horizontal Layout for spikes h_spikes = QHBoxLayout() h_spikes.addWidget(bad_spike_label) h_spikes.addWidget(self.spike_spin_box) h_spikes.addStretch() # - Horizontal Layout for threshold h_threshold = QHBoxLayout() h_threshold.addWidget(threshold_label) h_threshold.addWidget(self.threshold_spin_box) h_threshold.addStretch() # - Horizontal Layout for rolling window h_rolling = QHBoxLayout() h_rolling.addWidget(rolling_label) h_rolling.addWidget(self.rolling_spin_box) h_rolling.addStretch() # - Horizontal Layout for flag2flag - h_flag2flag = QHBoxLayout() h_flag2flag.addWidget(self.original_spin_box) h_flag2flag.addWidget(to_label) h_flag2flag.addWidget(self.translated_spin_box) h_flag2flag.addStretch() # - Vertical Layout for the Widget v_qc = QVBoxLayout() v_qc.addWidget(parameter_label) v_qc.addWidget(self.all_check) v_qc.addWidget(self.key_list) v_qc.addWidget(qc_label) v_qc.addWidget(self.reset_check) v_qc.addLayout(h_reset) v_qc.addWidget(self.range_check) v_qc.addLayout(h_ranges) v_qc.addWidget(self.flat_check) v_qc.addLayout(h_flat) v_qc.addWidget(self.spike_check) v_qc.addLayout(h_spikes) v_qc.addLayout(h_threshold) v_qc.addLayout(h_rolling) v_qc.addWidget(self.flag2flag_check) v_qc.addLayout(h_flag2flag) v_qc.addWidget(apply_button) v_qc.addWidget(close_button) v_qc.addStretch() self.setLayout(v_qc)
def load_ui(self): #Funkcija kas ielade galveno skatu self.observationList = QListWidget() self.plannedTargets = [] for target in self.targets[:10]: item = QListWidgetItem(str(target), self.observationList) #Aizpilda planotaju ar 10 targets kurus ieprieks nolasija no faila item.setData(Qt.UserRole, target) self.observationList.addItem(item) self.plannedTargets.append(target.name) self.layout.addWidget(self.observationList, 0, 0, 10, 2) self.observationList.itemSelectionChanged.connect(self.obsChanged) #Connect savieno kada UI elementa action (piemeram click) ar funkciju koda #Seit mainot izveleto elemntu listwidget izsauksies funkcija obsChanged for index in range(self.observationList.count()): item = self.observationList.item(index) self.targetLayout = QVBoxLayout() targetBox = QGroupBox() targetBox.setMaximumSize(350, 250) line = QHBoxLayout() nameLabel = QLabel("Target:") self.nameBox = QLineEdit() self.nameBox.setEnabled(False) nameLabel.setParent(targetBox) self.nameBox.setParent(targetBox) line.addWidget(nameLabel) line.addWidget(self.nameBox) self.targetLayout.addLayout(line) line = QHBoxLayout() priorityLabel = QLabel("Priority:") self.priorityBox = QLineEdit() priorityLabel.setParent(targetBox) self.priorityBox.setParent(targetBox) line.addWidget(priorityLabel) line.addWidget(self.priorityBox) self.targetLayout.addLayout(line) line = QHBoxLayout() obsLabel = QLabel("Obs per week:") self.obsBox = QLineEdit() obsLabel.setParent(targetBox) self.obsBox.setParent(targetBox) line.addWidget(obsLabel) line.addWidget(self.obsBox) self.targetLayout.addLayout(line) line = QHBoxLayout() scanLabel = QLabel("Scans per obs:") self.scanBox = QLineEdit() scanLabel.setParent(targetBox) self.scanBox.setParent(targetBox) line.addWidget(scanLabel) line.addWidget(self.scanBox) self.targetLayout.addLayout(line) line = QHBoxLayout() globalLabel = QLabel("Global time:") self.globalTimeBox = QLineEdit() line.addWidget(globalLabel) line.addWidget(self.globalTimeBox) self.targetLayout.addLayout(line) line = QHBoxLayout() specificLabel = QLabel("Specific times:") addTime = QPushButton("Add specific time") addTime.clicked.connect(self.add_time) line.addWidget(specificLabel) line.addWidget(addTime) self.targetLayout.addLayout(line) saveButton = QPushButton("Save changes") saveButton.clicked.connect(self.save_obs_changes) self.targetLayout.addWidget(saveButton) removeButton = QPushButton("Remove target") removeButton.clicked.connect(self.remove_obs) self.targetLayout.addWidget(removeButton) targetBox.setLayout(self.targetLayout) self.layout.addWidget(targetBox, 0, 2, 2, 1) self.targetComboBox = QComboBox() for key in self.targetsDict: if key not in self.plannedTargets: self.targetComboBox.addItem(key) self.layout.addWidget(self.targetComboBox, 2, 2) addButton = QPushButton("Add observation") addButton.clicked.connect(self.add_obs) self.layout.addWidget(addButton, 3, 2) nextButton = QPushButton("Schedule") nextButton.clicked.connect(self.prepare_schedule) self.layout.addWidget(nextButton, 0, 3) datesButton = QPushButton("Dates") datesButton.clicked.connect(self.edit_dates) self.layout.addWidget(datesButton, 1, 3) targetsButton = QPushButton("Targets") targetsButton.clicked.connect(self.edit_targets) self.layout.addWidget(targetsButton, 2, 3) calibratorsButton = QPushButton("Calibrators") calibratorsButton.clicked.connect(self.edit_calibrators) self.layout.addWidget(calibratorsButton, 3, 3) settingsButton = QPushButton("Settings") settingsButton.clicked.connect(self.load_settings) self.layout.addWidget(settingsButton, 4, 3) saveObsButton = QPushButton("Save observation") saveObsButton.clicked.connect(self.save_obs) self.layout.addWidget(saveObsButton, 5, 3) loadObsButton = QPushButton("Load observation") loadObsButton.clicked.connect(self.load_obs_new) self.layout.addWidget(loadObsButton, 6, 3)
def createFormGroupMapstats(self): self.formGroupMapstats = QWidget() mainLayout = QVBoxLayout() box = QGroupBox(_("General")) layout = QFormLayout() container = QHBoxLayout() self.qb_boxStyle = StyleComboBox( scctool.settings.casting_html_dir + "/src/css/mapstats", "mapstats") self.qb_boxStyle.connect2WS(self.controller, 'mapstats') label = QLabel(_("Style:")) label.setMinimumWidth(120) button = QPushButton(_("Show in Browser")) button.clicked.connect(lambda: self.openHTML( scctool.settings.casting_html_dir + "/mapstats.html")) container.addWidget(self.qb_boxStyle, 2) container.addWidget(button, 1) layout.addRow(label, container) self.cb_mappool = QComboBox() self.cb_mappool.addItem(_("Current Ladder Map Pool")) self.cb_mappool.addItem(_("Custom Map Pool (defined below)")) self.cb_mappool.addItem(_("Currently entered Maps only")) self.cb_mappool.setCurrentIndex( self.controller.mapstatsManager.getMapPoolType()) self.cb_mappool.currentIndexChanged.connect(self.changed) layout.addRow(QLabel(_("Map Pool:")), self.cb_mappool) self.cb_autoset_map = QCheckBox(_("Select the next map automatically")) self.cb_autoset_map.setChecked( scctool.settings.config.parser.getboolean("Mapstats", "autoset_next_map")) self.cb_autoset_map.stateChanged.connect(self.changed) label = QLabel(_("Next Map:")) label.setMinimumWidth(120) layout.addRow(label, self.cb_autoset_map) self.cb_mark_played = QCheckBox(_("Mark already played maps")) self.cb_mark_played.setChecked( scctool.settings.config.parser.getboolean("Mapstats", "mark_played")) self.cb_mark_played.stateChanged.connect(self.changed) label = QLabel(_("Mark:")) label.setMinimumWidth(120) layout.addRow(label, self.cb_mark_played) box.setLayout(layout) mainLayout.addWidget(box) box = QGroupBox(_("Custom Map Pool")) layout = QGridLayout() self.maplist = QListWidget() self.maplist.setSortingEnabled(True) ls = list(self.controller.mapstatsManager.getCustomMapPool()) self.maplist.addItems(ls) self.maplist.setCurrentItem(self.maplist.item(0)) layout.addWidget(self.maplist, 0, 0, 3, 1) qb_add = QPushButton() pixmap = QIcon(scctool.settings.getResFile('add.png')) qb_add.setIcon(pixmap) qb_add.clicked.connect(self.addMap) layout.addWidget(qb_add, 0, 1) qb_remove = QPushButton() pixmap = QIcon(scctool.settings.getResFile('delete.png')) qb_remove.clicked.connect(self.removeMap) qb_remove.setIcon(pixmap) layout.addWidget(qb_remove, 1, 1) self.sc_removeMap = QShortcut(QKeySequence("Del"), self) self.sc_removeMap.setAutoRepeat(False) self.sc_removeMap.activated.connect(self.removeMap) box.setLayout(layout) mainLayout.addWidget(box) mainLayout.addItem( QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)) self.formGroupMapstats.setLayout(mainLayout)
def __init__(self): super().__init__() try: urlopen('http://maia.usno.navy.mil/ser7/finals2000A.all') except HTTPError as e: print("Main IERS link not working, using mirror") iers.conf.iers_auto_url = 'http://toshi.nofs.navy.mil/ser7/finals2000A.all' except URLError as e: print("Main IERS link not working, using mirror") iers.conf.iers_auto_url = 'http://toshi.nofs.navy.mil/ser7/finals2000A.all' #download_IERS_A() plt.style.use(astropy_mpl_style) irbeneLocation = EarthLocation(lat=57.5535171694 * u.deg, lon=21.8545525000 * u.deg, height=87.30 * u.m) self.irbene = Observer(location=irbeneLocation, name="Irbene", timezone="Europe/Riga") observe_time = Time(['2019-02-05 15:30:00']) self.targets = [] self.targetsDict = {} with open("config/config.csv", "r") as csvfile: next(csvfile) reader = csv.reader(csvfile, delimiter=",", quotechar="|") for row in reader: sourceName = row[0] raText = row[1] raText = insert(raText, 'h', 2) #Nolasa targets no faila un ievieto targetsDict un targets raText = insert(raText, 'm', 5) raText = insert(raText, 's', len(raText)) decText = row[2] if (decText[0] != "-"): decText = insert(decText, 'd', 2) decText = insert(decText, 'm', 5) decText = insert(decText, 's', len(decText)) else: decText = insert(decText, 'd', 3) decText = insert(decText, 'm', 6) decText = insert(decText, 's', len(decText)) ra = Angle(raText) dec = Angle(decText) targetCoord = SkyCoord(frame='icrs', ra=ra, dec=dec, obstime="J2000") target = FixedTarget(coord=targetCoord, name=sourceName) plannedObs = PlannedObs(target, int(row[4]), int(row[3]), int(row[5])) self.targets.append(plannedObs) # target / obs per_week / priority / scans per obs coords = {"ra": ra, "dec": dec} self.targetsDict[sourceName] = coords self.targets = sorted(self.targets, key=lambda x: x.priority) # sort targets by priority self.calibrators = [] self.calibratorsDict = {} with open("config/calibrators.csv", "r") as csvfile: next(csvfile) reader = csv.reader(csvfile, delimiter=";", quotechar="|") for row in reader: sourceName = row[0] raText = str(row[1]).replace(" ", "") raText = insert(raText, 'h', 2) raText = insert(raText, 'm', 5) raText = insert(raText, 's', len(raText)) decText = str(row[2]).replace(" ", "") if (decText[0] != "-"): decText = insert(decText, 'd', 3) decText = insert(decText, 'm', 6) decText = insert(decText, 's', len(decText)) else: decText = insert(decText, 'd', 3) decText = insert(decText, 'm', 6) decText = insert(decText, 's', len(decText)) #Nolasa no faila calibratorus un ievieto calibratorsDict un calibrators ra = Angle(raText) dec = Angle(decText) coords = {"ra": ra, "dec": dec} self.calibratorsDict[sourceName] = coords calibratorCoord = SkyCoord(frame='icrs', ra=ra, dec=dec, obstime="J2000") calibrator = FixedTarget(coord=calibratorCoord, name=sourceName) self.calibrators.append(calibrator) startArray, endArray, summaryArray = get_all_events() #No google calendar sanem noverosanas datumus un laikus self.dateList = QListWidget() tempCheck = True for i in range(len(startArray)): dayStart = parse(startArray[i]) dayEnd = parse(endArray[i]) daySummary = summaryArray[i] daySummary = daySummary + " " + str(dayStart.date()) + " " + str(dayStart.time()) + "-" + str(dayEnd.time()) item = QListWidgetItem(daySummary, self.dateList) item.setData(Qt.UserRole, [dayStart, dayEnd]) #Izveido listwidget item no datuma un laika un to ievieto listwidget item.setFlags(item.flags() | Qt.ItemIsUserCheckable) item.setCheckState(Qt.Unchecked) if tempCheck and "maser" in daySummary: item.setCheckState(Qt.Checked) tempCheck = False self.dateList.addItem(item) config = configparser.ConfigParser() config.read('config/config.ini') self.config = config._sections['Default'] self.config['calibration'] = config['Default'].getboolean('calibration') #Nolasa config failu self.layout = QGridLayout() self.layout.setSpacing(0) self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.resize(1000, 600) self.dateBoxList = [] self.targetTimesCount = 0 self.load_ui()
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.width = self.frameGeometry().width() self.height = self.frameGeometry().height() """label = QLabel('Username', self) center = (QDesktopWidget().availableGeometry().center()) label.move(center.x()-140,0.8*center.y()-50-50) self.textbox = QLineEdit(self) self.textbox.resize(280,40) self.textbox.move(center.x()-140,0.8*center.y() - 20-50) label = QLabel('Password', self) label.move(center.x()-140,center.y()-50-50) self.textbox1 = QLineEdit(self) self.textbox1.setEchoMode(QLineEdit.Password) self.textbox1.resize(280,40) self.textbox1.move(center.x()-140,center.y() - 20-50) self.button = QPushButton('MainScreen', self) self.button.resize(140, 30) self.button.setCheckable(True) self.button.toggle() self.button.move(center.x()-70,center.y() + 40-50)""" W = self.frameGeometry().width() H = self.frameGeometry().height() PlayImages = [] self.TrackAList = QListWidget(self) self.TrackAList.setMaximumWidth(500) self.TrackAList.setMaximumHeight(500) self.TrackAList.move(16, 96) self.TrackAList.resize(400, 300) self.TrackAList.setSelectionMode(1) global TrackBrowsers for i in range(len(RDMXFiles)): self.TrackAList.insertItem(i, RDMXFiles[i].replace(".rdmx", "")) TrackBrowsers.append(self.TrackAList) self.TrackBList = QListWidget(self) self.TrackBList.setMaximumWidth(500) self.TrackBList.setMaximumHeight(500) self.TrackBList.move(1024 + 16, 96) self.TrackBList.resize(400, 300) for i in range(len(RDMXFiles)): self.TrackBList.insertItem(i, RDMXFiles[i].replace(".rdmx", "")) TrackBrowsers.append(self.TrackBList) self.TrackCList = QListWidget(self) self.TrackCList.setMaximumWidth(500) self.TrackCList.setMaximumHeight(500) self.TrackCList.move(16, 512 + 96 + 96) self.TrackCList.resize(400, 300) for i in range(len(RDMXFiles)): self.TrackCList.insertItem(i, RDMXFiles[i].replace(".rdmx", "")) TrackBrowsers.append(self.TrackCList) self.TrackDList = QListWidget(self) self.TrackDList.setMaximumWidth(500) self.TrackDList.setMaximumHeight(500) self.TrackDList.move(1024 + 16, 512 + 96 + 96) self.TrackDList.resize(400, 300) for i in range(len(RDMXFiles)): self.TrackDList.insertItem(i, RDMXFiles[i].replace(".rdmx", "")) TrackBrowsers.append(self.TrackDList) self.TrackADisplay = QLabel('128', self) self.showMaximized() self.show()
def createMissionGroupBox(self): # 1. Missions and instruments group of GUI def button1_find_datasets(): title = "Find Datasets" self.dataset_box.clear() self.file_box.clear() mission_list = [ item.text() for item in self.mission_box.selectedItems() ] instrument_list = [ item.text() for item in self.instrument_box.selectedItems() ] if len(mission_list) < 1 or len(instrument_list) < 1: msg = "Please select at least one mission and one instrument." show_my_message(title, msg) return 0 datasets = self.cda.get_datasets(mission_list, instrument_list) datalen = len(datasets) if datalen < 1: msg = "No datasets were found with these parameters." show_my_message(title, msg) return 0 elif datalen > 50: msg = "Number of datasets found: " + str(datalen) msg += "\nOnly 50 will be shown." show_my_message(title, msg) self.mission_selected.setText(str(mission_list)) self.instrument_selected.setText(str(instrument_list)) self.dataset_box.addItems(datasets[:50]) # Missions group GUI elements self.missionGroupBox = QGroupBox("Missions and Instruments") label1 = QLabel("Mission Groups:") list1 = QListWidget(self) list1.setSelectionMode(QListWidget.MultiSelection) list1.setMinimumHeight(50) list1.setMinimumWidth(400) list1.addItems(self.cda.get_observatories()) self.mission_box = list1 label2 = QLabel("Instrument Types:") list2 = QListWidget(self) list2.setSelectionMode(QListWidget.MultiSelection) list2.setMinimumHeight(50) list2.setMinimumWidth(400) list2.addItems(self.cda.get_instruments()) self.instrument_box = list2 label3 = QLabel("Select one or more Mission Group(s) and one" + " or more Instrument Type(s) and press:") button1 = QPushButton("1. Find Datasets") button1.setStyleSheet(self.button_css) button1.clicked.connect(button1_find_datasets) # Create the layout and add GUI elements # row, column, rowSpan, columnSpan layout = QGridLayout() layout.addWidget(label1, 0, 0) layout.addWidget(label2, 0, 1) layout.addWidget(list1, 1, 0) layout.addWidget(list2, 1, 1) layout.addWidget(label3, 2, 0, 1, 1) layout.addWidget(button1, 2, 1, 1, 1) self.missionGroupBox.setLayout(layout)