def initUI(self): in_class = "users" self.sidebar = sidebar.Sidebar(self) # self.sidebar.window.connect(self.getvalue) self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar) header = AppName(in_class) footer = Footer() add_and_search = AddSearchFrame(in_class) add_and_search.add_button.clicked.connect( lambda: self.add_users(in_class)) add_and_search.search_button.clicked.connect( lambda: self.search_users(add_and_search.search_box)) self.table = QTableWidget() self.table.setColumnCount(5) # self.table.setStyleSheet("border: none") # self.table.setStyleSheet( # "background-color: rgb(255, 255, 255);\n" # 'font: 10pt "MS Shell Dlg 2";\n' # "color: rgb(30, 45, 66);" # ) # self.table.setHorizontalHeaderItem(0, QTableWidgetItem("ID")) self.table.setHorizontalHeaderItem(0, QTableWidgetItem("Usernmae")) self.table.setHorizontalHeaderItem(1, QTableWidgetItem("Password")) self.table.setHorizontalHeaderItem(2, QTableWidgetItem("Roles")) # self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Bonus")) # self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Joining Date")) # self.table.setHorizontalHeaderItem(6, QTableWidgetItem("Total Salary")) self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Edit")) self.table.setHorizontalHeaderItem(4, QTableWidgetItem("Delete")) data = self.load_users_data() print(data) for x in data: print(x) self.populate_table(data) self.table.resizeColumnsToContents() layout = QVBoxLayout() layout.addWidget(header) layout.addWidget(add_and_search) layout.addWidget(self.table) # layout.addStretch() layout.addWidget(footer) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) self.setContentsMargins(0, 0, 0, 0) # self.resize(800, 600) self.setWindowTitle("Employee") self.resize(1160, 605) self.show() self.center()
def __init__(self): gr.top_block.__init__(self, "Drone Detection") Qt.QWidget.__init__(self) self.setWindowTitle("Drone Detection") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QHBoxLayout(self.top_widget) self.data_params_layout = Qt.QHBoxLayout() self.directory_params_layout = Qt.QHBoxLayout() self.top_left_layout = Qt.QVBoxLayout() self.top_right_layout = Qt.QVBoxLayout() self.settings = Qt.QSettings("GNU Radio", "top_block") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.directory = directory = "/home/eamedina/Documentos/freq_docs" self.spectrum_scan_button = spectrum_scan_button = 0 self.jammer_button = jammer_button = 0 self.base_scan_button = base_scan_button = 0 self.band_scan_button = band_scan_button = 0 self.graphic_band_choose = graphic_band_choose = 0 self.samp_rate = 20e6 self.fft_size = 1024 self.freq_max = 6000e6 self.center_freq = self.samp_rate/2 self.table_sort_index = 1 self.table_sort_reverse = True self.bandwidth_range = bandwidth_range = 20 self.samp_rate_chooser = samp_rate_chooser = 20 self.center_freq_range = center_freq_range = 3000 self.fft_size_chooser = fft_size_chooser = 1024 self.update_graph_button = update_graph_button = 0 self.update_params_button = update_params_button = 0 self.update_diretory_button = update_directory_button = 0 self.loop_min_freq = self.samp_rate/2 self.loop_max_freq = self.freq_max ################################################## # Blocks ################################################## #SCRIPT BUTTONS _spectrum_scan_button_push_button = Qt.QPushButton('Spectrum Scan') self._spectrum_scan_button_choices = {'Pressed': 1, 'Released': 0} _spectrum_scan_button_push_button.pressed.connect(lambda: self.set_spectrum_scan_button(self._spectrum_scan_button_choices['Pressed'])) _spectrum_scan_button_push_button.released.connect(lambda: self.set_spectrum_scan_button(self._spectrum_scan_button_choices['Released'])) _jammer_button_push_button = Qt.QPushButton('Jammer') self._jammer_button_choices = {'Pressed': 1, 'Released': 0} _jammer_button_push_button.pressed.connect(lambda: self.set_jammer_button(self._jammer_button_choices['Pressed'])) _jammer_button_push_button.released.connect(lambda: self.set_jammer_button(self._jammer_button_choices['Released'])) _base_scan_button_push_button = Qt.QPushButton('Base Scan') self._base_scan_button_choices = {'Pressed': 1, 'Released': 0} _base_scan_button_push_button.pressed.connect(lambda: self.set_base_scan_button(self._base_scan_button_choices['Pressed'])) _base_scan_button_push_button.released.connect(lambda: self.set_base_scan_button(self._base_scan_button_choices['Released'])) _band_scan_button_push_button = Qt.QPushButton('Band Scan') self._band_scan_button_choices = {'Pressed': 1, 'Released': 0} _band_scan_button_push_button.pressed.connect(lambda: self.set_band_scan_button(self._band_scan_button_choices['Pressed'])) _band_scan_button_push_button.released.connect(lambda: self.set_band_scan_button(self._band_scan_button_choices['Released'])) #GRAPH PARAMS self._directory_entry_tool_bar = Qt.QToolBar(self) self._directory_entry_tool_bar.addWidget(Qt.QLabel('Directory'+": ")) self._directory_entry_line_edit = Qt.QLineEdit(str(self.directory)) self._directory_entry_line_edit.setReadOnly(True) self._directory_entry_tool_bar.addWidget(self._directory_entry_line_edit) self._directory_entry_line_edit.returnPressed.connect( lambda: self.set_directory_entry(str(str(self._directory_entry_line_edit.text().toAscii())))) _update_directory_button_push_button = Qt.QPushButton('Select Directory') self._update_directory_button_choices = {'Pressed': 1, 'Released': 0} _update_directory_button_push_button.pressed.connect(lambda: self.set_update_directory_button(self._update_directory_button_choices['Pressed'])) _update_directory_button_push_button.released.connect(lambda: self.set_update_directory_button(self._update_directory_button_choices['Released'])) self._graphic_band_choose_options = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) self._graphic_band_choose_labels = ('CONTINUOUS', 'ALL', '433 MHz', '868 MHz', 'Wifi 2.4GHz (1)', 'Wifi 2.4GHz (2)', 'Wifi 2.4GHz (3)', 'Wifi 2.4GHz (4)', 'Wifi 2.4GHz (5)', 'Wifi 2.4GHz (6)*', 'Wifi 2.4GHz (7)*', 'Wifi 2.4GHz (8)*', 'Wifi 2.4GHz (9)*', 'Wifi 2.4GHz (10)*') self._graphic_band_choose_tool_bar = Qt.QToolBar(self) self._graphic_band_choose_tool_bar.addWidget(Qt.QLabel("Choose band"+": ")) self._graphic_band_choose_combo_box = Qt.QComboBox() self._graphic_band_choose_tool_bar.addWidget(self._graphic_band_choose_combo_box) for label in self._graphic_band_choose_labels: self._graphic_band_choose_combo_box.addItem(label) self._graphic_band_choose_callback = lambda i: Qt.QMetaObject.invokeMethod(self._graphic_band_choose_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._graphic_band_choose_options.index(i))) self._graphic_band_choose_callback(self.graphic_band_choose) self._graphic_band_choose_combo_box.currentIndexChanged.connect( lambda i: self.set_graphic_band_choose(self._graphic_band_choose_options[i])) self._samp_rate_chooser_options = (10, 20, ) self._samp_rate_chooser_labels = ('10 Msps', '20 Msps', ) self._samp_rate_chooser_tool_bar = Qt.QToolBar(self) self._samp_rate_chooser_tool_bar.addWidget(Qt.QLabel('Sample Rate'+": ")) self._samp_rate_chooser_combo_box = Qt.QComboBox() self._samp_rate_chooser_tool_bar.addWidget(self._samp_rate_chooser_combo_box) for label in self._samp_rate_chooser_labels: self._samp_rate_chooser_combo_box.addItem(label) self._samp_rate_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(self._samp_rate_chooser_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_chooser_options.index(i))) self._samp_rate_chooser_callback(self.samp_rate_chooser) self._samp_rate_chooser_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate_chooser(self._samp_rate_chooser_options[i])) self._fft_size_chooser_options = (1024, 2048, ) self._fft_size_chooser_labels = (str(self._fft_size_chooser_options[0]), str(self._fft_size_chooser_options[1]), ) self._fft_size_chooser_tool_bar = Qt.QToolBar(self) self._fft_size_chooser_tool_bar.addWidget(Qt.QLabel('FFT Size'+": ")) self._fft_size_chooser_combo_box = Qt.QComboBox() self._fft_size_chooser_tool_bar.addWidget(self._fft_size_chooser_combo_box) for label in self._fft_size_chooser_labels: self._fft_size_chooser_combo_box.addItem(label) self._fft_size_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(self._fft_size_chooser_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._fft_size_chooser_options.index(i))) self._fft_size_chooser_callback(self.fft_size_chooser) self._fft_size_chooser_combo_box.currentIndexChanged.connect( lambda i: self.set_fft_size_chooser(self._fft_size_chooser_options[i])) _update_params_button_push_button = Qt.QPushButton('Update Params.') self._update_params_button_choices = {'Pressed': 1, 'Released': 0} _update_params_button_push_button.pressed.connect(lambda: self.set_update_params_button(self._update_params_button_choices['Pressed'])) _update_params_button_push_button.released.connect(lambda: self.set_update_params_button(self._update_params_button_choices['Released'])) #FREQUENCY/RANGE CONTROLS self._center_freq_range_range = Range(5, 6000, 5, 3000, 200) self._center_freq_range_win = RangeWidget(self._center_freq_range_range, self.set_center_freq_range, 'Freq. (MHz)', "counter_slider", float) self._bandwidth_range_range = Range(10, 6000, 10, 20, 200) self._bandwidth_range_win = RangeWidget(self._bandwidth_range_range, self.set_bandwidth_range, 'Bandwidth (MHz)', "counter_slider", float) _update_graph_button_push_button = Qt.QPushButton('Update Graph') self._update_graph_button_choices = {'Pressed': 1, 'Released': 0} _update_graph_button_push_button.pressed.connect(lambda: self.set_update_graph_button(self._update_graph_button_choices['Pressed'])) _update_graph_button_push_button.released.connect(lambda: self.set_update_graph_button(self._update_graph_button_choices['Released'])) #GRAPHIC/PLOT self.dynamic_canvas = FigureCanvas(Figure(figsize=(5, 3))) self._dynamic_ax = self.dynamic_canvas.figure.subplots() #TABLE self.tableWidget = QTableWidget() self.tableWidget.horizontalHeader().sectionClicked.connect(self.tableClicked) #LEFT LAYOUT self.top_left_layout.addWidget(_base_scan_button_push_button) self.top_left_layout.addWidget(_spectrum_scan_button_push_button) self.top_left_layout.addWidget(_band_scan_button_push_button) self.top_left_layout.addWidget(_jammer_button_push_button) #DIRECTORY LAYOUT self.directory_params_layout.addWidget(self._directory_entry_tool_bar) self.directory_params_layout.addWidget(_update_directory_button_push_button) #DATA PARAMS LAYOUT self.data_params_layout.addWidget(self._samp_rate_chooser_tool_bar) self.data_params_layout.addWidget(self._fft_size_chooser_tool_bar) self.data_params_layout.addWidget(_update_params_button_push_button) #FREQUENCY PARAMS LAYOUT self.freq_container = Qt.QWidget() self.freq_params_v_layout = Qt.QVBoxLayout(self.freq_container) self.freq_params_h_layout = Qt.QHBoxLayout() self.freq_params_h_layout.addWidget(self._bandwidth_range_win) self.freq_params_h_layout.addWidget(_update_graph_button_push_button) self.freq_params_v_layout.addWidget(self._center_freq_range_win) self.freq_params_v_layout.addLayout(self.freq_params_h_layout) self.freq_container.setVisible(False) #RIGHT LAYOUT self.top_right_layout.addLayout(self.directory_params_layout) self.top_right_layout.addLayout(self.data_params_layout) self.top_right_layout.addWidget(self._graphic_band_choose_tool_bar) self.top_right_layout.addWidget(self.freq_container) self.top_right_layout.addWidget(self.dynamic_canvas) self.top_right_layout.addWidget(self.tableWidget) self.top_layout.addLayout(self.top_left_layout) self.top_layout.addLayout(self.top_right_layout) self.updateScanDataForFreq() self.startContinuosBandTimer() self.updateTableData()
def __init__(self): super(QWidget, self).__init__() self.move_board_name = "Board" self.setObjectName("tasks_tab") # The main layout in which all other widgets will be self.main_layout = QHBoxLayout() # Set the layout of the Tasks_Tab self.setLayout(self.main_layout) # Layout for the tree area widget or the left side of the GUI self.left_layout = QVBoxLayout() #label for tree self.tree_view_label = QLabel("Boards, Lists, and Tasks") self.tree_view_label.setAlignment(Qt.AlignLeft) # Tree area widget to hold the tree view self.tree_area = QWidget() self.tree_area.setObjectName("tree_area") # self.tree_area.setGeometry(0,0,200,607) self.tree_area.setLayout(self.left_layout) self.tree_area.setMaximumSize(200,500) # Tree view object to see boards, lists, and taskcards names self.trello_view = QTreeView() self.trello_view.setMaximumSize(200,500) #treeView.resize(256,607) self.trello_view.setHeaderHidden(True) self.trello_model = QStandardItemModel() self.trello_root_node = self.trello_model.invisibleRootItem() # This would initially populate the list view with items self.update_trello_tree() self.trello_view.setModel(self.trello_model) self.trello_view.expandAll() self.trello_view.clicked.connect(self.get_value_tree) self.left_layout.addWidget(self.tree_view_label) self.left_layout.addWidget(self.trello_view) # middle portion of the task tab self.task_card_section = QWidget() self.middle_layout = QVBoxLayout() self.task_card_section.setLayout(self.middle_layout) self.task_move_widget = QWidget() self.task_move_layout = QVBoxLayout() self.task_move_widget.setLayout(self.task_move_layout) self.task_move_labels_widget = QWidget() self.task_move_labels_layout = QHBoxLayout() self.task_move_labels_widget.setLayout(self.task_move_labels_layout) self.task_move_label = QLabel("Move Task From") self.task_move_label.setAlignment(Qt.AlignLeft) self.task_move_label2 = QLabel("Move Task To") self.task_move_label2.setAlignment(Qt.AlignRight) self.task_move_labels_layout.addWidget(self.task_move_label) self.task_move_labels_layout.addWidget(self.task_move_label2) self.task_inputs_widget = QWidget() self.task_inputs_layout = QHBoxLayout() self.task_inputs_widget.setLayout(self.task_inputs_layout) self.move_board_combo_timer = QTimer() self.move_board_combo_timer.timeout.connect(lambda: self.board_combo_update(self.move_board_combo)) self.move_board_combo_timer.start(30000) self.move_list_combo_timer = QTimer() self.move_list_combo_timer.timeout.connect(lambda: self.list_combo_update(self.move_list_combo)) self.move_list_combo_timer.start(30000) self.move_card_combo_timer = QTimer() self.move_card_combo_timer.timeout.connect(lambda: self.card_combo_update(self.move_card_combo)) self.move_card_combo_timer.start(30000) self.move_board_combo = QComboBox() self.move_list_combo = QComboBox() self.move_card_combo = QComboBox() self.move_card_button = QPushButton("Move Task") self.task_inputs_layout.addWidget(self.move_board_combo) self.task_inputs_layout.addWidget(self.move_list_combo) self.task_inputs_layout.addWidget(self.move_card_combo) self.task_inputs_layout.addWidget(self.move_card_button) self.task_move_layout.addWidget(self.task_move_labels_widget) self.task_move_layout.addWidget(self.task_inputs_widget) self.task_card_button_widget = QWidget(self.task_card_section) self.task_card_button_set = QHBoxLayout() self.task_card_button_widget.setLayout(self.task_card_button_set) self.task_card_label = QLabel("Task") self.task_card_label.setAlignment(Qt.AlignCenter) self.task_card = QTableWidget() self.task_card.setGeometry(266, 0, 256, 303) self.delete_task_button = QPushButton("Delete Task") self.delete_task_button.clicked.connect(self.delete_task) self.edit_task_button = QPushButton("Edit Description") self.edit_task_button.clicked.connect(self.edit_description) self.task_card_button_set.addWidget(self.edit_task_button) self.task_card_button_set.addWidget(self.delete_task_button) self.create_task_widget = QWidget() self.create_task_widget_layout = QVBoxLayout() self.create_task_widget.setLayout(self.create_task_widget_layout) self.add_board_widget = QWidget() self.add_board_widget_layout = QHBoxLayout() self.add_board_widget.setLayout(self.add_board_widget_layout) #self.add_board_label = QLabel("") self.add_board_edit = QLineEdit() self.add_board_edit.setPlaceholderText("Enter name of Board") self.add_board_button = QPushButton("Add Board") self.add_board_button.clicked.connect(self.add_board) self.delete_board_button = QPushButton("Delete Board") self.delete_board_button.clicked.connect(self.delete_board) #self.add_board_widget_layout.addWidget(self.add_board_label) self.add_board_widget_layout.addWidget(self.add_board_edit) self.add_board_widget_layout.addWidget(self.add_board_button) self.add_board_widget_layout.addWidget(self.delete_board_button) self.add_list_widget = QWidget() self.add_list_widget_layout = QHBoxLayout() self.add_list_widget.setLayout(self.add_list_widget_layout) #self.add_list_label = QLabel("") self.add_list_edit = QLineEdit() self.add_list_edit.setPlaceholderText("Enter name of List") self.add_list_button = QPushButton("Add List") self.add_list_button.clicked.connect(self.add_list) self.delete_list_button = QPushButton("Delete List") self.delete_list_button.clicked.connect(self.delete_list) #self.add_list_widget_layout.addWidget(self.add_list_label) self.add_list_widget_layout.addWidget(self.add_list_edit) self.add_list_widget_layout.addWidget(self.add_list_button) self.add_list_widget_layout.addWidget(self.delete_list_button) self.pick_task_widget = QWidget()#self.create_task_widget self.pick_task_layout = QHBoxLayout() self.pick_task_widget.setLayout(self.pick_task_layout) self.board_combo = QComboBox() self.list_combo = QComboBox() self.pick_task_layout.addWidget(self.board_combo) self.pick_task_layout.addWidget(self.list_combo) self.name_task_widget = QWidget() self.name_task_widget_layout = QHBoxLayout() self.name_task_widget.setLayout(self.name_task_widget_layout) self.task_name_label = QLabel("Name of Task: ") self.task_entry = QLineEdit() self.name_task_widget_layout.addWidget(self.task_name_label) self.name_task_widget_layout.addWidget(self.task_entry) self.task_description_widget = QWidget() self.task_description_layout = QVBoxLayout() self.task_description_widget.setLayout(self.task_description_layout) #self.task_edit_label = QLabel() self.task_description_edit = QTextEdit() self.task_description_edit.setPlaceholderText("Enter a description of your task.") self.task_add_button = QPushButton("Add Task") self.task_add_button.clicked.connect(self.add_task) #self.task_description_layout.addWidget(self.task_edit_label) self.task_description_layout.addWidget(self.task_description_edit) self.task_description_layout.addWidget(self.task_add_button) self.create_task_widget_layout.addWidget(self.pick_task_widget) self.create_task_widget_layout.addWidget(self.name_task_widget) self.create_task_widget_layout.addWidget(self.task_description_edit) self.create_task_widget_layout.addWidget(self.task_add_button) self.middle_layout.addWidget(self.add_board_widget) self.middle_layout.addWidget(self.add_list_widget) self.middle_layout.addWidget(self.task_move_widget) self.middle_layout.addWidget(self.task_card_label) self.middle_layout.addWidget(self.task_card) self.middle_layout.addWidget(self.task_card_button_widget) self.middle_layout.addWidget(self.create_task_widget) # right side of the window layout havent figured out what goes here self.right_side_widget = QWidget(self) self.layout_right = QVBoxLayout() self.right_side_widget.setLayout(self.layout_right) self.layout_right.addWidget(self.right_side_widget) self.right_side_widget.resize(300, 300) self.main_layout.addWidget(self.tree_area) self.main_layout.addWidget(self.task_card_section)
def __init__(self, persepolis_setting): super().__init__() icon = QtGui.QIcon() self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle(QCoreApplication.translate("setting_ui_tr", 'Preferences')) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) global icons icons = ':/' + str(self.persepolis_setting.value('settings/icons')) + '/' # main layout window_verticalLayout = QVBoxLayout(self) # setting_tabWidget self.setting_tabWidget = QTabWidget(self) # download_options_tab self.download_options_tab = QWidget() download_options_tab_verticalLayout = QVBoxLayout(self.download_options_tab) download_options_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # tries tries_horizontalLayout = QHBoxLayout() self.tries_label = QLabel(self.download_options_tab) tries_horizontalLayout.addWidget(self.tries_label) self.tries_spinBox = QSpinBox(self.download_options_tab) self.tries_spinBox.setMinimum(1) tries_horizontalLayout.addWidget(self.tries_spinBox) download_options_tab_verticalLayout.addLayout(tries_horizontalLayout) #wait wait_horizontalLayout = QHBoxLayout() self.wait_label = QLabel(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_label) self.wait_spinBox = QSpinBox(self.download_options_tab) wait_horizontalLayout.addWidget(self.wait_spinBox) download_options_tab_verticalLayout.addLayout(wait_horizontalLayout) # time_out time_out_horizontalLayout = QHBoxLayout() self.time_out_label = QLabel(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_label) self.time_out_spinBox = QSpinBox(self.download_options_tab) time_out_horizontalLayout.addWidget(self.time_out_spinBox) download_options_tab_verticalLayout.addLayout(time_out_horizontalLayout) # connections connections_horizontalLayout = QHBoxLayout() self.connections_label = QLabel(self.download_options_tab) connections_horizontalLayout.addWidget(self.connections_label) self.connections_spinBox = QSpinBox(self.download_options_tab) self.connections_spinBox.setMinimum(1) self.connections_spinBox.setMaximum(16) connections_horizontalLayout.addWidget(self.connections_spinBox) download_options_tab_verticalLayout.addLayout(connections_horizontalLayout) # rpc_port self.rpc_port_label = QLabel(self.download_options_tab) self.rpc_horizontalLayout = QHBoxLayout() self.rpc_horizontalLayout.addWidget(self.rpc_port_label) self.rpc_port_spinbox = QSpinBox(self.download_options_tab) self.rpc_port_spinbox.setMinimum(1024) self.rpc_port_spinbox.setMaximum(65535) self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox) download_options_tab_verticalLayout.addLayout( self.rpc_horizontalLayout) # wait_queue wait_queue_horizontalLayout = QHBoxLayout() self.wait_queue_label = QLabel(self.download_options_tab) wait_queue_horizontalLayout.addWidget(self.wait_queue_label) self.wait_queue_time = QDateTimeEdit(self.download_options_tab) self.wait_queue_time.setDisplayFormat('H:mm') wait_queue_horizontalLayout.addWidget(self.wait_queue_time) download_options_tab_verticalLayout.addLayout( wait_queue_horizontalLayout) # change aria2 path aria2_path_verticalLayout = QVBoxLayout() self.aria2_path_checkBox = QCheckBox(self.download_options_tab) aria2_path_verticalLayout.addWidget(self.aria2_path_checkBox) aria2_path_horizontalLayout = QHBoxLayout() self.aria2_path_lineEdit = QLineEdit(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_lineEdit) self.aria2_path_pushButton = QPushButton(self.download_options_tab) aria2_path_horizontalLayout.addWidget(self.aria2_path_pushButton) aria2_path_verticalLayout.addLayout(aria2_path_horizontalLayout) download_options_tab_verticalLayout.addLayout(aria2_path_verticalLayout) download_options_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.download_options_tab, "") # save_as_tab self.save_as_tab = QWidget() save_as_tab_verticalLayout = QVBoxLayout(self.save_as_tab) save_as_tab_verticalLayout.setContentsMargins(20, 30, 0, 0) # download_folder self.download_folder_horizontalLayout = QHBoxLayout() self.download_folder_label = QLabel(self.save_as_tab) self.download_folder_horizontalLayout.addWidget( self.download_folder_label) self.download_folder_lineEdit = QLineEdit(self.save_as_tab) self.download_folder_horizontalLayout.addWidget(self.download_folder_lineEdit) self.download_folder_pushButton = QPushButton(self.save_as_tab) self.download_folder_horizontalLayout.addWidget(self.download_folder_pushButton) save_as_tab_verticalLayout.addLayout(self.download_folder_horizontalLayout) # temp_download_folder self.temp_horizontalLayout = QHBoxLayout() self.temp_download_label = QLabel(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_label) self.temp_download_lineEdit = QLineEdit(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit) self.temp_download_pushButton = QPushButton(self.save_as_tab) self.temp_horizontalLayout.addWidget(self.temp_download_pushButton) save_as_tab_verticalLayout.addLayout(self.temp_horizontalLayout) # create subfolder self.subfolder_checkBox = QCheckBox(self.save_as_tab) save_as_tab_verticalLayout.addWidget(self.subfolder_checkBox) save_as_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.save_as_tab, "") # notifications_tab self.notifications_tab = QWidget() notification_tab_verticalLayout = QVBoxLayout(self.notifications_tab) notification_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) self.enable_notifications_checkBox = QCheckBox(self.notifications_tab) notification_tab_verticalLayout.addWidget(self.enable_notifications_checkBox) self.sound_frame = QFrame(self.notifications_tab) self.sound_frame.setFrameShape(QFrame.StyledPanel) self.sound_frame.setFrameShadow(QFrame.Raised) verticalLayout = QVBoxLayout(self.sound_frame) self.volume_label = QLabel(self.sound_frame) verticalLayout.addWidget(self.volume_label) self.volume_dial = QDial(self.sound_frame) self.volume_dial.setProperty("value", 100) verticalLayout.addWidget(self.volume_dial) notification_tab_verticalLayout.addWidget(self.sound_frame) # message_notification message_notification_horizontalLayout = QHBoxLayout() self.notification_label = QLabel(self.notifications_tab) message_notification_horizontalLayout.addWidget(self.notification_label) self.notification_comboBox = QComboBox(self.notifications_tab) message_notification_horizontalLayout.addWidget(self.notification_comboBox) notification_tab_verticalLayout.addLayout(message_notification_horizontalLayout) notification_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.notifications_tab, "") # style_tab self.style_tab = QWidget() style_tab_verticalLayout = QVBoxLayout(self.style_tab) style_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # style style_horizontalLayout = QHBoxLayout() self.style_label = QLabel(self.style_tab) style_horizontalLayout.addWidget(self.style_label) self.style_comboBox = QComboBox(self.style_tab) style_horizontalLayout.addWidget(self.style_comboBox) style_tab_verticalLayout.addLayout(style_horizontalLayout) # language language_horizontalLayout = QHBoxLayout() self.lang_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.lang_label) self.lang_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.lang_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) language_horizontalLayout = QHBoxLayout() self.lang_label.setText(QCoreApplication.translate("setting_ui_tr", "Language:")) # color scheme self.color_label = QLabel(self.style_tab) language_horizontalLayout.addWidget(self.color_label) self.color_comboBox = QComboBox(self.style_tab) language_horizontalLayout.addWidget(self.color_comboBox) style_tab_verticalLayout.addLayout(language_horizontalLayout) # icons icons_horizontalLayout = QHBoxLayout() self.icon_label = QLabel(self.style_tab) icons_horizontalLayout.addWidget(self.icon_label) self.icon_comboBox = QComboBox(self.style_tab) icons_horizontalLayout.addWidget(self.icon_comboBox) style_tab_verticalLayout.addLayout(icons_horizontalLayout) self.icons_size_horizontalLayout = QHBoxLayout() self.icons_size_label = QLabel(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_label) self.icons_size_comboBox = QComboBox(self.style_tab) self.icons_size_horizontalLayout.addWidget(self.icons_size_comboBox) style_tab_verticalLayout.addLayout(self.icons_size_horizontalLayout) # font font_horizontalLayout = QHBoxLayout() self.font_checkBox = QCheckBox(self.style_tab) font_horizontalLayout.addWidget(self.font_checkBox) self.fontComboBox = QFontComboBox(self.style_tab) font_horizontalLayout.addWidget(self.fontComboBox) self.font_size_label = QLabel(self.style_tab) font_horizontalLayout.addWidget(self.font_size_label) self.font_size_spinBox = QSpinBox(self.style_tab) self.font_size_spinBox.setMinimum(1) font_horizontalLayout.addWidget(self.font_size_spinBox) style_tab_verticalLayout.addLayout(font_horizontalLayout) self.setting_tabWidget.addTab(self.style_tab, "") window_verticalLayout.addWidget(self.setting_tabWidget) # Enable system tray icon self.enable_system_tray_checkBox = QCheckBox(self.style_tab) style_tab_verticalLayout.addWidget(self.enable_system_tray_checkBox) # after_download dialog self.after_download_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.after_download_checkBox) # show_menubar_checkbox self.show_menubar_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_menubar_checkbox) # show_sidepanel_checkbox self.show_sidepanel_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_sidepanel_checkbox) # hide progress window self.show_progress_window_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.show_progress_window_checkbox) # add persepolis to startup self.startup_checkbox = QCheckBox() style_tab_verticalLayout.addWidget(self.startup_checkbox) # keep system awake self.keep_awake_checkBox = QCheckBox() style_tab_verticalLayout.addWidget(self.keep_awake_checkBox) style_tab_verticalLayout.addStretch(1) # columns_tab self.columns_tab = QWidget() columns_tab_verticalLayout = QVBoxLayout(self.columns_tab) columns_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # creating checkBox for columns self.show_column_label = QLabel() self.column0_checkBox = QCheckBox() self.column1_checkBox = QCheckBox() self.column2_checkBox = QCheckBox() self.column3_checkBox = QCheckBox() self.column4_checkBox = QCheckBox() self.column5_checkBox = QCheckBox() self.column6_checkBox = QCheckBox() self.column7_checkBox = QCheckBox() self.column10_checkBox = QCheckBox() self.column11_checkBox = QCheckBox() self.column12_checkBox = QCheckBox() columns_tab_verticalLayout.addWidget(self.show_column_label) columns_tab_verticalLayout.addWidget(self.column0_checkBox) columns_tab_verticalLayout.addWidget(self.column1_checkBox) columns_tab_verticalLayout.addWidget(self.column2_checkBox) columns_tab_verticalLayout.addWidget(self.column3_checkBox) columns_tab_verticalLayout.addWidget(self.column4_checkBox) columns_tab_verticalLayout.addWidget(self.column5_checkBox) columns_tab_verticalLayout.addWidget(self.column6_checkBox) columns_tab_verticalLayout.addWidget(self.column7_checkBox) columns_tab_verticalLayout.addWidget(self.column10_checkBox) columns_tab_verticalLayout.addWidget(self.column11_checkBox) columns_tab_verticalLayout.addWidget(self.column12_checkBox) columns_tab_verticalLayout.addStretch(1) self.setting_tabWidget.addTab(self.columns_tab, '') # video_finder_tab self.video_finder_tab = QWidget() video_finder_layout = QVBoxLayout(self.video_finder_tab) video_finder_layout.setContentsMargins(21, 21, 0, 0) video_finder_tab_verticalLayout = QVBoxLayout() # Whether to enable video link capturing. self.enable_video_finder_checkbox = QCheckBox(self.video_finder_tab) video_finder_layout.addWidget(self.enable_video_finder_checkbox) # If we should hide videos with no audio self.hide_no_audio_checkbox = QCheckBox(self.video_finder_tab) video_finder_tab_verticalLayout.addWidget(self.hide_no_audio_checkbox) # If we should hide audios without video self.hide_no_video_checkbox = QCheckBox(self.video_finder_tab) video_finder_tab_verticalLayout.addWidget(self.hide_no_video_checkbox) max_links_horizontalLayout = QHBoxLayout() # max_links_label self.max_links_label = QLabel(self.video_finder_tab) max_links_horizontalLayout.addWidget(self.max_links_label) # max_links_spinBox self.max_links_spinBox = QSpinBox(self.video_finder_tab) self.max_links_spinBox.setMinimum(1) self.max_links_spinBox.setMaximum(16) max_links_horizontalLayout.addWidget(self.max_links_spinBox) video_finder_tab_verticalLayout.addLayout(max_links_horizontalLayout) self.video_finder_dl_path_horizontalLayout = QHBoxLayout() self.video_finder_frame = QFrame(self.video_finder_tab) self.video_finder_frame.setLayout(video_finder_tab_verticalLayout) video_finder_tab_verticalLayout.addStretch(1) video_finder_layout.addWidget(self.video_finder_frame) self.setting_tabWidget.addTab(self.video_finder_tab, "") # shortcut tab self.shortcut_tab = QWidget() shortcut_tab_verticalLayout = QVBoxLayout(self.shortcut_tab) shortcut_tab_verticalLayout.setContentsMargins(21, 21, 0, 0) # shortcut_table self.shortcut_table = QTableWidget(self) self.shortcut_table.setColumnCount(2) self.shortcut_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.shortcut_table.setSelectionMode(QAbstractItemView.SingleSelection) self.shortcut_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.shortcut_table.verticalHeader().hide() shortcut_table_header = [QCoreApplication.translate("setting_ui_tr", 'Action'), QCoreApplication.translate("setting_ui_tr", 'Shortcut')] self.shortcut_table.setHorizontalHeaderLabels(shortcut_table_header) shortcut_tab_verticalLayout.addWidget(self.shortcut_table) self.setting_tabWidget.addTab(self.shortcut_tab, QCoreApplication.translate("setting_ui_tr", "Shortcuts")) # Actions actions_list = [QCoreApplication.translate('setting_ui_tr', 'Quit'), QCoreApplication.translate('setting_ui_tr', 'Minimize main window to the tray icon'), QCoreApplication.translate('setting_ui_tr', 'Remove download items'), QCoreApplication.translate('setting_ui_tr', 'Delete download items'), QCoreApplication.translate('setting_ui_tr', 'Move up selected items'), QCoreApplication.translate('setting_ui_tr', 'Move down selected items'), QCoreApplication.translate('setting_ui_tr', 'Add new download link'), QCoreApplication.translate('setting_ui_tr', 'Add new Video link'), QCoreApplication.translate('setting_ui_tr', 'Import links from text file')] # add actions to the shortcut_table j = 0 for action in actions_list: item = QTableWidgetItem(str(action)) # align center item.setTextAlignment(0x0004 | 0x0080) # insert item in shortcut_table self.shortcut_table.insertRow(j) self.shortcut_table.setItem(j, 0, item) j = j + 1 self.shortcut_table.resizeColumnsToContents() # window buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) self.defaults_pushButton = QPushButton(self) buttons_horizontalLayout.addWidget(self.defaults_pushButton) self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # set style_tab for default self.setting_tabWidget.setCurrentIndex(3) # labels and translations self.setWindowTitle(QCoreApplication.translate("setting_ui_tr", "Preferences")) self.tries_label.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>")) self.tries_label.setText(QCoreApplication.translate("setting_ui_tr", "Number of tries: ")) self.tries_spinBox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set number of tries if download failed.</p></body></html>")) self.wait_label.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>")) self.wait_label.setText(QCoreApplication.translate("setting_ui_tr", "Wait between retries (seconds): ")) self.wait_spinBox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html>")) self.time_out_label.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>")) self.time_out_label.setText(QCoreApplication.translate("setting_ui_tr", "Timeout (seconds): ")) self.time_out_spinBox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Set timeout in seconds. </p></body></html>")) self.connections_label.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>")) self.connections_label.setText(QCoreApplication.translate("setting_ui_tr", "Number of connections: ")) self.connections_spinBox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>")) self.rpc_port_label.setText(QCoreApplication.translate("setting_ui_tr", "RPC port number: ")) self.rpc_port_spinbox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>")) self.wait_queue_label.setText(QCoreApplication.translate("setting_ui_tr", 'Wait between every downloads in queue:')) self.aria2_path_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Change Aria2 default path')) self.aria2_path_pushButton.setText(QCoreApplication.translate("setting_ui_tr", 'Change')) aria2_path_tooltip =QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Attention: Wrong path may have caused problem! Do it carefully or don't change default setting!</p></body></html>" ) self.aria2_path_checkBox.setToolTip(aria2_path_tooltip) self.aria2_path_lineEdit.setToolTip(aria2_path_tooltip) self.aria2_path_pushButton.setToolTip(aria2_path_tooltip) self.setting_tabWidget.setTabText(self.setting_tabWidget.indexOf( self.download_options_tab), QCoreApplication.translate("setting_ui_tr", "Download Options")) self.download_folder_label.setText(QCoreApplication.translate("setting_ui_tr", "Download Folder: ")) self.download_folder_pushButton.setText(QCoreApplication.translate("setting_ui_tr", "Change")) self.temp_download_label.setText(QCoreApplication.translate("setting_ui_tr", "Temporary Download Folder: ")) self.temp_download_pushButton.setText(QCoreApplication.translate("setting_ui_tr", "Change")) self.subfolder_checkBox.setText(QCoreApplication.translate("setting_ui_tr", "Create subfolders for Music,Videos,... in default download folder")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.save_as_tab), QCoreApplication.translate("setting_ui_tr", "Save as")) self.enable_notifications_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Enable notification sounds")) self.volume_label.setText(QCoreApplication.translate("setting_ui_tr", "Volume: ")) self.setting_tabWidget.setTabText(self.setting_tabWidget.indexOf( self.notifications_tab), QCoreApplication.translate("setting_ui_tr", "Notifications")) self.style_label.setText(QCoreApplication.translate("setting_ui_tr", "Style: ")) self.color_label.setText(QCoreApplication.translate("setting_ui_tr", "Color scheme: ")) self.icon_label.setText(QCoreApplication.translate("setting_ui_tr", "Icons: ")) self.icons_size_label.setText(QCoreApplication.translate("setting_ui_tr", "Toolbar's icons size: ")) self.notification_label.setText(QCoreApplication.translate("setting_ui_tr", "Notification type: ")) self.font_checkBox.setText(QCoreApplication.translate("setting_ui_tr", "Font: ")) self.font_size_label.setText(QCoreApplication.translate("setting_ui_tr", "Size: ")) self.enable_system_tray_checkBox.setText(QCoreApplication.translate("setting_ui_tr", "Enable system tray icon.")) self.after_download_checkBox.setText( QCoreApplication.translate("setting_ui_tr", "Show download complete dialog when download has finished.")) self.show_menubar_checkbox.setText(QCoreApplication.translate("setting_ui_tr", "Show menubar.")) self.show_sidepanel_checkbox.setText(QCoreApplication.translate("setting_ui_tr", "Show side panel.")) self.show_progress_window_checkbox.setText( QCoreApplication.translate("setting_ui_tr", "Show download's progress window")) self.startup_checkbox.setText(QCoreApplication.translate("setting_ui_tr", "Run Persepolis at startup")) self.keep_awake_checkBox.setText(QCoreApplication.translate("setting_ui_tr", "Keep system awake!")) self.keep_awake_checkBox.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>This option is preventing system from going to sleep.\ This is necessary if your power manager is suspending system automatically. </p></body></html>")) self.wait_queue_time.setToolTip( QCoreApplication.translate("setting_ui_tr", "<html><head/><body><p>Format HH:MM</p></body></html>")) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.style_tab), QCoreApplication.translate("setting_ui_tr", "Preferences")) # columns_tab self.show_column_label.setText(QCoreApplication.translate("setting_ui_tr", 'Show this columns:')) self.column0_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'File Name')) self.column1_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Status')) self.column2_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Size')) self.column3_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Downloaded')) self.column4_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Percentage')) self.column5_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Connections')) self.column6_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Transfer rate')) self.column7_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Estimated time left')) self.column10_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'First try date')) self.column11_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Last try date')) self.column12_checkBox.setText(QCoreApplication.translate("setting_ui_tr", 'Category')) self.setting_tabWidget.setTabText( self.setting_tabWidget.indexOf(self.columns_tab), QCoreApplication.translate("setting_ui_tr", "Columns customization")) # Video Finder options tab self.setting_tabWidget.setTabText(self.setting_tabWidget.indexOf( self.video_finder_tab), QCoreApplication.translate("setting_ui_tr", "Video Finder Options")) self.enable_video_finder_checkbox.setText(QCoreApplication.translate("setting_ui_tr", 'Enable Video Finder')) self.hide_no_audio_checkbox.setText(QCoreApplication.translate("setting_ui_tr", 'Hide videos with no audio')) self.hide_no_video_checkbox.setText(QCoreApplication.translate("setting_ui_tr", 'Hide audios with no video')) self.max_links_label.setText(QCoreApplication.translate("setting_ui_tr", 'Maximum number of links to capture:<br/>' '<small>(If browser sends multiple video links at a time)</small>')) # window buttons self.defaults_pushButton.setText(QCoreApplication.translate("setting_ui_tr", "Defaults")) self.cancel_pushButton.setText(QCoreApplication.translate("setting_ui_tr", "Cancel")) self.ok_pushButton.setText(QCoreApplication.translate("setting_ui_tr", "OK"))
def out_frame_func(int_lng, prj_path, mesh_name_txt, pd_2, castellatedMC_visible): castellatedMC_2_obj = None #----------------Если файл castellatedMC_2.pkl существует, получаем данные из него для вывода в форму---------------# prs_lvl_grid = QGridLayout() prs_lvl_frame = QFrame() prs_lvl_frame.setLayout(prs_lvl_grid) if castellatedMC_visible == True: castellatedMC_2_path_file = prj_path + '/' + mesh_name_txt + '_' + pd_2 + '/' + 'castellatedMC_2.pkl' if os.path.exists(castellatedMC_2_path_file): input = open(castellatedMC_2_path_file, 'rb') castellatedMC_2_obj = pickle.load(input) input.close() castellatedMC_1_path_file = prj_path + '/' + mesh_name_txt + '_' + pd_2 + '/' + 'castellatedMC_1.pkl' if os.path.exists(castellatedMC_1_path_file): input = open(castellatedMC_1_path_file, 'rb') castellatedMC_1_obj = pickle.load(input) input.close() initial_path_file = prj_path + '/' + mesh_name_txt + '_' + pd_2 + '/' + 'initial.pkl' if os.path.exists(initial_path_file): input = open(initial_path_file, 'rb') obj_initial = pickle.load(input) input.close() geometry_2_path_file = prj_path + '/' + mesh_name_txt + '_' + pd_2 + '/' + 'geometry_2.pkl' if os.path.exists(geometry_2_path_file): input = open(geometry_2_path_file, 'rb') obj_2_geometry = pickle.load(input) input.close() tri_distirbTri_list = [] tri_distirbTri_geometry_list = [] other_geometry_list = [] other_geometry_list_geom = [] i = 1 for el in obj_2_geometry: if el['geometry_' + str(i)] == 'Tri-surface' or el[ 'geometry_' + str(i)] == 'Три-поверхность' or el[ 'geometry_' + str(i)] == 'Distributed tri-surface' or el[ 'geometry_' + str(i)] == 'Распределенная три-поверхность': tri_distirbTri_list.append(True) tri_distirbTri_geometry_list.append(el['file']) other_geometry_list.append(False) other_geometry_list_geom.append(el['file']) elif el['geometry_' + str(i)] == 'Base shape complex' or el[ 'geometry_' + str(i)] == 'Набор базовых фигур': other_geometry_list_geom.append(el['name']) other_geometry_list.append(True) elif el['geometry_' + str(i)] == 'Base shape' or el[ 'geometry_' + str(i)] == 'Базовая фигура': other_geometry_list_geom.append(el['shape']) other_geometry_list.append(True) i = i + 1 f_level_single_list = [] if obj_initial['f'] == True and True in tri_distirbTri_list: ##-------------------------------------Первая таблица---------------------------------------------## cMC_f_lvl_lbl = QLabel() if int_lng == 'Russian': cMC_f_lvl_lbl.setText( "Параметры уровней для ячеек при измельчении") elif int_lng == 'English': cMC_f_lvl_lbl.setText("Level parameters for cells in grinding") cMC_features_obj_list = castellatedMC_1_obj['features'] f_level_multi_val_list = [] el_CMC_f_list = [] for el_CMC_f in cMC_features_obj_list: f_level_single = el_CMC_f['f_level_single'] el_CMC_f_list.append(el_CMC_f['f_geometry']) if f_level_single == False: f_level_multi_val = el_CMC_f['f_level_multi_val'] f_level_multi_val_list.append(f_level_multi_val) f_level_single_list.append(f_level_single) else: f_level_single_list.append(f_level_single) if False in f_level_single_list: max_val = max(f_level_multi_val_list) else: max_val = 1 cMC_f_lvl_table = QTableWidget() width = 150 + 250 * max_val height = 30 + len(cMC_features_obj_list) * 30 cMC_f_lvl_table.setFixedSize(width, height) cMC_f_lvl_table.setRowCount(obj_initial['f_val']) if f_level_multi_val_list == []: cMC_f_lvl_table.setColumnCount(2) else: cMC_f_lvl_table.setColumnCount(max_val + 1) cMC_f_lvl_table.verticalHeader().hide() cMC_f_lvl_table.horizontalHeader().resizeSection(0, 150) cMC_f_lvl_table.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Fixed) column_1 = QTableWidgetItem() cMC_f_lvl_table.setHorizontalHeaderItem(0, column_1) cMC_f_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_1.setText("Три-поверхность") elif int_lng == 'English': column_1.setText("Tri-surface") q = 0 for el_CMC_f in cMC_features_obj_list: #geometry# f_geometry_edit = QComboBox() f_geometry_edit.setFixedSize(110, 25) f_geometry_edit.addItems(el_CMC_f_list) f_geometry_hbox = QHBoxLayout() f_geometry_hbox.setContentsMargins(0, 0, 0, 0) f_geometry_hbox.addWidget(f_geometry_edit) f_geometry_cell_widget = QWidget() f_geometry_cell_widget.setLayout(f_geometry_hbox) if castellatedMC_2_obj != None: f_geometry_edit_mas = f_geometry_edit.count() for t in range(f_geometry_edit_mas): if f_geometry_edit.itemText(t) == castellatedMC_2_obj[ 'CM_features_lvl'][q]['geometry']: f_geometry_edit.setCurrentIndex(t) cMC_f_lvl_table.setCellWidget(q, 0, f_geometry_cell_widget) #level# f_level_single = el_CMC_f['f_level_single'] if f_level_single == True: f_level_single_val = QSpinBox() if castellatedMC_2_obj != None: f_level_single_val.setValue( castellatedMC_2_obj['CM_features_lvl'][q] ['lvl_prs']['lvl_single']) f_level_single_val.setFixedSize(50, 25) f_level_single_val.setRange(0, 1000) f_level_single_val_hbox = QHBoxLayout() f_level_single_val_hbox.setContentsMargins(0, 0, 0, 0) f_level_single_val_hbox.addWidget(f_level_single_val) f_level_cell_widget = QWidget() f_level_cell_widget.setLayout(f_level_single_val_hbox) cMC_f_lvl_table.horizontalHeader().resizeSection(1, 245) cMC_f_lvl_table.horizontalHeader().setResizeMode( 1, QtGui.QHeaderView.Fixed) column_2 = QTableWidgetItem() cMC_f_lvl_table.setHorizontalHeaderItem(1, column_2) cMC_f_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_2.setText("Уровень_1") elif int_lng == 'English': column_2.setText("Level_1") cMC_f_lvl_table.setCellWidget(q, 1, f_level_cell_widget) elif f_level_single == False: f_level_multi_val = el_CMC_f['f_level_multi_val'] r = 1 l = 0 while r <= f_level_multi_val: flmv_min_lbl = QLabel() flmv_min = QSpinBox() flmv_min.setFixedSize(50, 25) flmv_min.setRange(0, 1000) if castellatedMC_2_obj != None: flmv_min.setValue( castellatedMC_2_obj['CM_features_lvl'][q] ['multi_prs'][l]['lvl_multi_' + str(r)][0]) flmv_max_lbl = QLabel() flmv_max = QSpinBox() flmv_max.setFixedSize(50, 25) flmv_max.setRange(0, 1000) if castellatedMC_2_obj != None: flmv_min.setValue( castellatedMC_2_obj['CM_features_lvl'][q] ['multi_prs'][l]['lvl_multi_' + str(r)][1]) cMC_f_lvl_table.horizontalHeader().resizeSection( r, 245) cMC_f_lvl_table.horizontalHeader().setResizeMode( r, QtGui.QHeaderView.Fixed) column_2 = QTableWidgetItem() cMC_f_lvl_table.setHorizontalHeaderItem(r, column_2) cMC_f_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_2.setText("Уровень_" + str(r)) elif int_lng == 'English': column_2.setText("Level_" + str(r)) if int_lng == 'Russian': flmv_min_lbl.setText("Мин_" + str(r) + ":") flmv_max_lbl.setText("Макс_" + str(r) + ":") elif int_lng == 'English': flmv_min_lbl.setText("Min_" + str(r) + ":") flmv_max_lbl.setText("Max_" + str(r) + ":") flmv_min_max_hbox = QHBoxLayout() flmv_min_max_hbox.setContentsMargins(0, 0, 0, 0) flmv_min_max_hbox.addWidget(flmv_min_lbl) flmv_min_max_hbox.addWidget(flmv_min) flmv_min_max_hbox.addWidget(flmv_max_lbl) flmv_min_max_hbox.addWidget(flmv_max) flmv_min_max_cell_widget = QWidget() flmv_min_max_cell_widget.setLayout(flmv_min_max_hbox) cMC_f_lvl_table.setCellWidget( q, r, flmv_min_max_cell_widget) r = r + 1 l = l + 1 q = q + 1 prs_lvl_grid.addWidget(cMC_f_lvl_lbl, 0, 0, alignment=QtCore.Qt.AlignCenter) prs_lvl_grid.addWidget(cMC_f_lvl_table, 1, 0, alignment=QtCore.Qt.AlignCenter) #--------------------------------------Вторая таблица-----------------------------------# el_CMC_rS_regions_list = [] if obj_initial['rS'] == True and True in tri_distirbTri_list: cMC_refinementSurfaces_obj_list = castellatedMC_1_obj[ 'refinementSurfaces'] el_CMC_rS_list = [] for el_CMC_rS in cMC_refinementSurfaces_obj_list: el_CMC_rS_list.append(el_CMC_rS['rS_surface']) el_CMC_rS_regions_list.append(el_CMC_rS['rS_regions']) if obj_initial['rS'] == True and True in el_CMC_rS_regions_list: cMC_rS_lvl_lbl = QLabel() if int_lng == 'Russian': cMC_rS_lvl_lbl.setText( "Параметры уровней для поверхностей") elif int_lng == 'English': cMC_rS_lvl_lbl.setText("Level parameters for surfaces") #Определям макс длину массива rS_level_multi_val_list = [] for el_CMC_f in cMC_refinementSurfaces_obj_list: rS_level = el_CMC_f['rS_regions'] if rS_level == True: rS_level_val = el_CMC_f['rS_regions_val'] rS_level_multi_val_list.append(rS_level_val) if rS_level == True: max_val = max(rS_level_multi_val_list) else: max_val = 1 cMC_rS_lvl_table = QTableWidget() width = 150 + 290 * max_val + 5 height = 30 + len(cMC_refinementSurfaces_obj_list) * 30 cMC_rS_lvl_table.setFixedSize(width, height) cMC_rS_lvl_table.setRowCount(obj_initial['rS_val']) cMC_rS_lvl_table.verticalHeader().hide() if rS_level_multi_val_list == []: cMC_rS_lvl_table.setColumnCount(2) else: cMC_rS_lvl_table.setColumnCount(max_val + 1) cMC_rS_lvl_table.verticalHeader().hide() cMC_rS_lvl_table.horizontalHeader().resizeSection(0, 150) cMC_rS_lvl_table.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Fixed) column_1 = QTableWidgetItem() cMC_rS_lvl_table.setHorizontalHeaderItem(0, column_1) cMC_rS_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_1.setText("Поверхность") elif int_lng == 'English': column_1.setText("Surface") q = 0 for el_CMC_rS in cMC_refinementSurfaces_obj_list: #rS_surface# rS_geometry_edit = QComboBox() rS_geometry_edit.setFixedSize(110, 25) rS_geometry_edit.addItems(el_CMC_rS_list) rS_geometry_hbox = QHBoxLayout() rS_geometry_hbox.setContentsMargins(0, 0, 0, 0) rS_geometry_hbox.addWidget(rS_geometry_edit) rS_geometry_cell_widget = QWidget() rS_geometry_cell_widget.setLayout(rS_geometry_hbox) if castellatedMC_2_obj != None: rS_geometry_edit_mas = rS_geometry_edit.count() for t in range(rS_geometry_edit_mas): if rS_geometry_edit.itemText( t) == castellatedMC_2_obj[ 'CM_refinementSurface_lvl'][q][ 'rS_surface']: f_geometry_edit.setCurrentIndex(t) cMC_rS_lvl_table.setCellWidget(q, 0, rS_geometry_cell_widget) rS_regions_val = el_CMC_rS['rS_regions_val'] r = 1 l = 0 while r <= rS_regions_val: cMC_rS_lvl_table.horizontalHeader().resizeSection( r, 290) cMC_rS_lvl_table.horizontalHeader().setResizeMode( r, QtGui.QHeaderView.Fixed) column_2 = QTableWidgetItem() cMC_rS_lvl_table.setHorizontalHeaderItem(r, column_2) cMC_rS_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") rslmv_reg_edit = QLineEdit() rslmv_reg_edit.setFixedSize(100, 25) regexp = QtCore.QRegExp('[А-яА-Яa-zA-Z0-9\_]+') validator = QtGui.QRegExpValidator(regexp) rslmv_reg_edit.setValidator(validator) if castellatedMC_2_obj != None: rslmv_reg_edit.setText( castellatedMC_2_obj['CM_refinementSurface_lvl'] [q]['rS_regions'][l]) rslmv_min_lbl = QLabel() rslmv_min = QSpinBox() rslmv_min.setFixedSize(45, 25) rslmv_min.setRange(0, 1000) if castellatedMC_2_obj != None: rslmv_min.setValue( castellatedMC_2_obj['CM_refinementSurface_lvl'] [q]['rS_levels'][l][0]) rslmv_max_lbl = QLabel() rslmv_max = QSpinBox() rslmv_max.setFixedSize(45, 25) rslmv_max.setRange(0, 1000) if castellatedMC_2_obj != None: rslmv_max.setValue( castellatedMC_2_obj['CM_refinementSurface_lvl'] [q]['rS_levels'][l][1]) if int_lng == 'Russian': rslmv_min_lbl.setText("Мин:") rslmv_max_lbl.setText("Макс:") column_2.setText("Подобласть_" + str(r)) elif int_lng == 'English': rslmv_min_lbl.setText("Min:") rslmv_max_lbl.setText("Max:") column_2.setText("Subregion_" + str(r)) rslmv_min_max_hbox = QHBoxLayout() rslmv_min_max_hbox.setContentsMargins(0, 0, 0, 0) rslmv_min_max_hbox.addWidget(rslmv_reg_edit) rslmv_min_max_hbox.addWidget(rslmv_min_lbl) rslmv_min_max_hbox.addWidget(rslmv_min) rslmv_min_max_hbox.addWidget(rslmv_max_lbl) rslmv_min_max_hbox.addWidget(rslmv_max) rslmv_min_max_cell_widget = QWidget() rslmv_min_max_cell_widget.setLayout(rslmv_min_max_hbox) cMC_rS_lvl_table.setCellWidget( q, r, rslmv_min_max_cell_widget) l = l + 1 r = r + 1 q = q + 1 prs_lvl_grid.addWidget(cMC_rS_lvl_lbl, 2, 0, alignment=QtCore.Qt.AlignCenter) prs_lvl_grid.addWidget(cMC_rS_lvl_table, 3, 0, alignment=QtCore.Qt.AlignCenter) rR_level_single_list = [] if obj_initial['rR'] == True and True in other_geometry_list: ##-------------------------------------Третья таблица---------------------------------------------## cMC_refinementRegions_obj_list = castellatedMC_1_obj[ 'refinementRegions'] el_CMC_rR_list = [] for el_CMC_rR in cMC_refinementRegions_obj_list: el_CMC_rR_list.append(el_CMC_rR['rR_surface']) cMC_rR_lvl_lbl = QLabel() if int_lng == 'Russian': cMC_rR_lvl_lbl.setText( "Параметры уровней для областей при измельчении") elif int_lng == 'English': cMC_rR_lvl_lbl.setText( "Level parameters for regions in grinding") #Определям макс длину массива rR_level_multi_val_list = [] for el_CMC_rR in cMC_refinementRegions_obj_list: rR_level_single = el_CMC_rR['rR_level_single'] if rR_level_single == False: rR_level_multi_val = el_CMC_rR['rR_level_multi_val'] rR_level_multi_val_list.append(rR_level_multi_val) rR_level_single_list.append(rR_level_single) else: rR_level_single_list.append(rR_level_single) if False in rR_level_single_list: max_val = max(rR_level_multi_val_list) else: max_val = 1 cMC_rR_lvl_table = QTableWidget() width = 150 + 213 * max_val height = 30 + len(cMC_refinementRegions_obj_list) * 30 cMC_rR_lvl_table.setFixedSize(width, height) cMC_rR_lvl_table.setRowCount(obj_initial['rR_val']) if rR_level_multi_val_list == []: cMC_rR_lvl_table.setColumnCount(2) else: cMC_rR_lvl_table.setColumnCount(max_val + 1) cMC_rR_lvl_table.verticalHeader().hide() cMC_rR_lvl_table.horizontalHeader().resizeSection(0, 150) cMC_rR_lvl_table.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Fixed) column_1 = QTableWidgetItem() cMC_rR_lvl_table.setHorizontalHeaderItem(0, column_1) cMC_rR_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_1.setText("Поверхность") elif int_lng == 'English': column_1.setText("Surface") q = 0 for el_CMC_rR in cMC_refinementRegions_obj_list: #rR_surface# rR_geometry_edit = QComboBox() rR_geometry_edit.setFixedSize(110, 25) rR_geometry_edit.addItems(el_CMC_rR_list) rR_geometry_hbox = QHBoxLayout() rR_geometry_hbox.setContentsMargins(0, 0, 0, 0) rR_geometry_hbox.addWidget(rR_geometry_edit) rR_geometry_cell_widget = QWidget() rR_geometry_cell_widget.setLayout(rR_geometry_hbox) if castellatedMC_2_obj != None: rR_geometry_edit_mas = rR_geometry_edit.count() for t in range(rR_geometry_edit_mas): if rR_geometry_edit.itemText(t) == castellatedMC_2_obj[ 'CM_refinementRegions_lvl'][q]['rR_surface']: rR_geometry_edit.setCurrentIndex(t) cMC_rR_lvl_table.setCellWidget(q, 0, rR_geometry_cell_widget) #level# rR_level_single = el_CMC_rR['rR_level_single'] if rR_level_single == True: rR_level_single_min_val_lbl = QLabel() rR_level_single_min_val = QSpinBox() rR_level_single_min_val.setFixedSize(50, 25) rR_level_single_min_val.setRange(0, 1000000000000000) if castellatedMC_2_obj != None: rR_level_single_min_val.setValue( castellatedMC_2_obj['CM_refinementRegions_lvl'][q] ['lvl_prs']['lvl_single_min']) rR_level_single_max_val_lbl = QLabel() rR_level_single_max_val = QSpinBox() rR_level_single_max_val.setFixedSize(50, 25) rR_level_single_max_val.setRange(0, 1000000000000000) if castellatedMC_2_obj != None: rR_level_single_max_val.setValue( castellatedMC_2_obj['CM_refinementRegions_lvl'][q] ['lvl_prs']['lvl_single_max']) rR_level_single_val_hbox = QHBoxLayout() rR_level_single_val_hbox.setContentsMargins(0, 0, 0, 0) rR_level_single_val_hbox.addWidget( rR_level_single_min_val_lbl) rR_level_single_val_hbox.addWidget(rR_level_single_min_val) rR_level_single_val_hbox.addWidget( rR_level_single_max_val_lbl) rR_level_single_val_hbox.addWidget(rR_level_single_max_val) rR_level_cell_widget = QWidget() rR_level_cell_widget.setLayout(rR_level_single_val_hbox) cMC_rR_lvl_table.horizontalHeader().resizeSection(1, 210) cMC_rR_lvl_table.horizontalHeader().setResizeMode( 1, QtGui.QHeaderView.Fixed) column_2 = QTableWidgetItem() cMC_rR_lvl_table.setHorizontalHeaderItem(1, column_2) cMC_rR_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_2.setText("Уровень_1") rR_level_single_min_val_lbl.setText("Мин" + ":") rR_level_single_max_val_lbl.setText("Макс" + ":") elif int_lng == 'English': column_2.setText("Level_1") rR_level_single_min_val_lbl.setText("Min" + ":") rR_level_single_max_val_lbl.setText("Max" + ":") cMC_rR_lvl_table.setCellWidget(q, 1, rR_level_cell_widget) elif rR_level_single == False: rR_level_multi_val = el_CMC_rR['rR_level_multi_val'] r = 1 l = 0 while r <= rR_level_multi_val: rRlmv_min_lbl = QLabel() rRlmv_min = QSpinBox() rRlmv_min.setFixedSize(50, 25) rRlmv_min.setRange(0, 1000) if castellatedMC_2_obj != None: rRlmv_min.setValue( castellatedMC_2_obj['CM_refinementRegions_lvl'] [q]['multi_prs'][l]['lvl_multi_' + str(r)][0]) rRlmv_max_lbl = QLabel() rRlmv_max = QSpinBox() rRlmv_max.setFixedSize(50, 25) rRlmv_max.setRange(0, 1000) if castellatedMC_2_obj != None: rRlmv_max.setValue( castellatedMC_2_obj['CM_refinementRegions_lvl'] [q]['multi_prs'][l]['lvl_multi_' + str(r)][1]) cMC_rR_lvl_table.horizontalHeader().resizeSection( r, 205) cMC_rR_lvl_table.horizontalHeader().setResizeMode( r, QtGui.QHeaderView.Fixed) column_2 = QTableWidgetItem() cMC_rR_lvl_table.setHorizontalHeaderItem(r, column_2) cMC_rR_lvl_table.horizontalHeader().setStyleSheet( "color: steelblue") if int_lng == 'Russian': column_2.setText("Уровень_" + str(r)) elif int_lng == 'English': column_2.setText("Level_" + str(r)) if int_lng == 'Russian': rRlmv_min_lbl.setText("Мин_" + str(r) + ":") rRlmv_max_lbl.setText("Макс_" + str(r) + ":") elif int_lng == 'English': rRlmv_min_lbl.setText("Min_" + str(r) + ":") rRlmv_max_lbl.setText("Max_" + str(r) + ":") rRlmv_min_max_hbox = QHBoxLayout() rRlmv_min_max_hbox.setContentsMargins(0, 0, 0, 0) rRlmv_min_max_hbox.addWidget(rRlmv_min_lbl) rRlmv_min_max_hbox.addWidget(rRlmv_min) rRlmv_min_max_hbox.addWidget(rRlmv_max_lbl) rRlmv_min_max_hbox.addWidget(rRlmv_max) rRlmv_min_max_cell_widget = QWidget() rRlmv_min_max_cell_widget.setLayout(rRlmv_min_max_hbox) cMC_rR_lvl_table.setCellWidget( q, r, rRlmv_min_max_cell_widget) r = r + 1 l = l + 1 q = q + 1 prs_lvl_grid.addWidget(cMC_rR_lvl_lbl, 4, 0, alignment=QtCore.Qt.AlignCenter) prs_lvl_grid.addWidget(cMC_rR_lvl_table, 5, 0, alignment=QtCore.Qt.AlignCenter) # -------------------------Кнопка сохранения --------------------------# castellatedMC_2_btnSave = QPushButton() castellatedMC_2_btnSave.setFixedSize(80, 25) buttons_hbox = QHBoxLayout() buttons_hbox.addWidget(castellatedMC_2_btnSave) if int_lng == 'Russian': castellatedMC_2_btnSave.setText("Записать") elif int_lng == 'English': castellatedMC_2_btnSave.setText("Write") # -----------------------Групповой элемент формы-----------------------# castellatedMC_2_grid = QGridLayout() castellatedMC_2_grid.addWidget(prs_lvl_frame, 0, 0, alignment=QtCore.Qt.AlignCenter) castellatedMC_2_grid.addLayout(buttons_hbox, 1, 0, alignment=QtCore.Qt.AlignCenter) castellatedMC_2_grid.setRowStretch(3, 6) castellatedMC_2_group = QGroupBox() castellatedMC_2_group.setLayout(castellatedMC_2_grid) return castellatedMC_2_group, castellatedMC_2_btnSave, prs_lvl_grid, f_level_single_list, rR_level_single_list, el_CMC_rS_regions_list
def __init__(self, events): super().__init__() self.events = events self.out = [] self.setWindowTitle("Advanced event filtering") vbox = QVBoxLayout() lb = QLabel("Filter") vbox.addWidget(lb) hbox = QHBoxLayout() self.logic = QLineEdit("") hbox.addWidget(self.logic) self.pb_filter = QPushButton("Filter events", clicked=self.filter) hbox.addWidget(self.pb_filter) self.pb_clear = QPushButton("Clear", clicked=self.logic.clear) self.pb_clear.setIcon(QIcon.fromTheme("edit-clear")) hbox.addWidget(self.pb_clear) vbox.addLayout(hbox) hbox = QHBoxLayout() self.rb_summary = QRadioButton("Summary", toggled=self.filter) self.rb_summary.setChecked(True) hbox.addWidget(self.rb_summary) self.rb_details = QRadioButton("Details", toggled=self.filter) hbox.addWidget(self.rb_details) vbox.addLayout(hbox) hbox = QHBoxLayout() vbox2 = QVBoxLayout() vbox2.addWidget(QLabel("Subjects")) self.lw1 = QListWidget() vbox2.addWidget(self.lw1) hbox.addLayout(vbox2) vbox2 = QVBoxLayout() vbox2.addWidget(QLabel("Behaviors")) self.lw2 = QListWidget() vbox2.addWidget(self.lw2) hbox.addLayout(vbox2) self.add_subj_behav_button = QPushButton("", clicked=self.add_subj_behav) self.add_subj_behav_button.setIcon(QIcon.fromTheme("go-up")) hbox.addWidget(self.add_subj_behav_button) vbox2 = QVBoxLayout() vbox2.addWidget(QLabel("Logical operators")) self.lw3 = QListWidget() self.lw3.addItems(["AND", "OR"]) vbox2.addWidget(self.lw3) hbox.addLayout(vbox2) self.add_logic_button = QPushButton("", clicked=self.add_logic) self.add_logic_button.setIcon(QIcon.fromTheme("go-up")) hbox.addWidget(self.add_logic_button) vbox.addLayout(hbox) self.lb_results = QLabel("Results") vbox.addWidget(self.lb_results) self.tw = QTableWidget(self) vbox.addWidget(self.tw) hbox = QHBoxLayout() hbox.addItem(QSpacerItem(241, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)) self.pb_save = QPushButton("Save results", clicked=self.save_results) hbox.addWidget(self.pb_save) self.pb_close = QPushButton("Close", clicked=self.close) hbox.addWidget(self.pb_close) vbox.addLayout(hbox) self.setLayout(vbox) subjects_list, behaviors_list = [], [] for obs_id in events: for subj_behav in events[obs_id]: subj, behav = subj_behav.split("|") subjects_list.append(subj) behaviors_list.append(behav) subjects_set = sorted(set(subjects_list)) behaviors_set = sorted(set(behaviors_list)) self.lw1.addItems(subjects_set) self.lw2.addItems(behaviors_set) self.resize(640, 640)
def initUI(self): # Window size and title self.setWindowTitle('Zerpy') self.resize(700, 700) self.setMinimumWidth(700) # Address label addressLabel = QLabel('Address') addressLabel.setAlignment(Qt.AlignCenter) # Address dropdown self.addressDropdown = QComboBox(self) for address in self.controller.config.data['accounts']: self.addressDropdown.addItem(address) self.addressDropdown.setCurrentText(self.controller.activeAccount) self.addressDropdown.activated.connect(self.on_dropdown_change) self.addressDropdown.setContextMenuPolicy(Qt.CustomContextMenu) self.addressDropdown.customContextMenuRequested.connect( self.on_dropdown_context_menu) # Refresh button refreshButton = QPushButton() refreshButton.setMaximumSize(40, 40) refreshIcon = QIcon.fromTheme("view-refresh") refreshButton.setIcon(refreshIcon) refreshButton.setIconSize(QSize(24, 24)) refreshButton.clicked.connect(self.refreshUI) refreshButton.setToolTip('Refresh balance and transactions') # Address layout addressayout = QHBoxLayout() addressayout.addWidget(addressLabel, 1) addressayout.addWidget(self.addressDropdown, 7) addressayout.addWidget(refreshButton) # Balance label balaceLabel = QLabel() balaceLabel.setText('Balance') balaceLabel.setAlignment(Qt.AlignCenter) # Balance amount label self.balaceAmountLabel = QLabel() self.balaceAmountLabel.setText(f'{self.controller.getBalance()} XRP') self.balaceAmountLabel.setAlignment(Qt.AlignCenter) font = QFont() font.setPointSize(20) self.balaceAmountLabel.setFont(font) # Balance layout balanceLayout = QVBoxLayout() balanceLayout.addWidget(balaceLabel) balanceLayout.addWidget(self.balaceAmountLabel) balanceLayout.setContentsMargins(0, 10, 0, 10) # Transactions label transactionsLabel = QLabel('Transactions') transactionsLabel.setAlignment(Qt.AlignCenter) # Transactions table self.tableWidget = QTableWidget() self.tableWidget.setColumnCount(1) self.tableWidget.verticalHeader().setVisible(False) self.tableWidget.horizontalHeader().setVisible(False) self.tableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # self.tableWidget.setRowHeight(10) self.tableWidget.horizontalHeader().setSectionResizeMode( 0, QHeaderView.Stretch) self.populateTable() monofont = QFont() monofont.setFamily("Courier New") monofont.setPointSize(10) self.tableWidget.setFont(monofont) # Transactions layout transactionsLayout = QVBoxLayout() transactionsLayout.addWidget(transactionsLabel) transactionsLayout.addWidget(self.tableWidget) # Send label A sendLabelA = QLabel('Send') sendLabelA.setAlignment(Qt.AlignCenter) # Send amount self.sendAmount = QLineEdit() self.sendAmount.setAlignment(Qt.AlignCenter) self.sendAmount.setFont(monofont) # Send label B sendLabelB = QLabel('XRP to') sendLabelB.setAlignment(Qt.AlignCenter) # Send address self.sendAddress = QLineEdit() self.sendAddress.setAlignment(Qt.AlignCenter) self.sendAddress.setFont(monofont) # Send button sendButton = QPushButton() sendButton.setMaximumSize(40, 40) sendIcon = QIcon.fromTheme("mail-send") sendButton.setIcon(sendIcon) sendButton.setIconSize(QSize(24, 24)) sendButton.clicked.connect(self.on_send_clicked) # Send layout sendLayout = QHBoxLayout() sendLayout.addWidget(sendLabelA) sendLayout.addWidget(self.sendAmount, 2) sendLayout.addWidget(sendLabelB) sendLayout.addWidget(self.sendAddress, 4) sendLayout.addWidget(sendButton) # sendLayout.setContentsMargins(0, 10, 0, 10) # Window layout layout = QVBoxLayout() layout.addLayout(addressayout) layout.addLayout(balanceLayout) layout.addLayout(transactionsLayout) layout.addLayout(sendLayout) self.setLayout(layout)
def __init__(self, parent=None, aw=None, activeTab=0): super(backgroundDlg, self).__init__(parent, aw) self.setWindowTitle( QApplication.translate("Form Caption", "Profile Background", None)) self.setModal(True) settings = QSettings() if settings.contains("BackgroundGeometry"): self.restoreGeometry(settings.value("BackgroundGeometry")) #TAB 1 self.pathedit = QLineEdit(self.aw.qmc.backgroundpath) self.pathedit.setStyleSheet("background-color:'lightgrey';") self.pathedit.setReadOnly(True) self.pathedit.setFocusPolicy(Qt.NoFocus) self.filename = "" self.backgroundCheck = QCheckBox( QApplication.translate("CheckBox", "Show", None)) self.backgroundDetails = QCheckBox( QApplication.translate("CheckBox", "Annotations", None)) self.backgroundeventsflag = QCheckBox( QApplication.translate("CheckBox", "Events", None)) self.backgroundDeltaETflag = QCheckBox() backgroundDeltaETflagLabel = QLabel( deltaLabelPrefix + QApplication.translate("Label", "ET", None)) self.backgroundDeltaBTflag = QCheckBox() backgroundDeltaBTflagLabel = QLabel( deltaLabelPrefix + QApplication.translate("Label", "BT", None)) self.backgroundETflag = QCheckBox( QApplication.translate("CheckBox", "ET", None)) self.backgroundBTflag = QCheckBox( QApplication.translate("CheckBox", "BT", None)) self.backgroundFullflag = QCheckBox( QApplication.translate("CheckBox", "Show Full", None)) self.backgroundCheck.setChecked(self.aw.qmc.background) self.backgroundDetails.setChecked(self.aw.qmc.backgroundDetails) self.backgroundeventsflag.setChecked(self.aw.qmc.backgroundeventsflag) self.backgroundDeltaETflag.setChecked(self.aw.qmc.DeltaETBflag) self.backgroundDeltaBTflag.setChecked(self.aw.qmc.DeltaBTBflag) self.backgroundETflag.setChecked(self.aw.qmc.backgroundETcurve) self.backgroundBTflag.setChecked(self.aw.qmc.backgroundBTcurve) self.backgroundFullflag.setChecked(self.aw.qmc.backgroundShowFullflag) loadButton = QPushButton(QApplication.translate( "Button", "Load", None)) loadButton.setFocusPolicy(Qt.NoFocus) delButton = QPushButton( QApplication.translate("Button", "Delete", None)) delButton.setFocusPolicy(Qt.NoFocus) # connect the ArtisanDialog standard OK/Cancel buttons self.dialogbuttons.accepted.connect(self.accept) self.dialogbuttons.removeButton( self.dialogbuttons.button(QDialogButtonBox.Cancel)) alignButton = QPushButton( QApplication.translate("Button", "Align", None)) alignButton.setFocusPolicy(Qt.NoFocus) self.alignComboBox = QComboBox() alignnames = [ QApplication.translate("Label", "CHARGE", None), QApplication.translate("Label", "DRY", None), QApplication.translate("Label", "FCs", None), QApplication.translate("Label", "FCe", None), QApplication.translate("Label", "SCs", None), QApplication.translate("Label", "SCe", None), QApplication.translate("Label", "DROP", None), QApplication.translate("Label", "ALL", None), ] self.alignComboBox.addItems(alignnames) self.alignComboBox.setCurrentIndex(self.aw.qmc.alignEvent) self.alignComboBox.currentIndexChanged.connect( self.changeAlignEventidx) loadButton.clicked.connect(self.load) alignButton.clicked.connect(self.timealign) self.speedSpinBox = QSpinBox() self.speedSpinBox.setAlignment(Qt.AlignRight) self.speedSpinBox.setRange(1, 90) self.speedSpinBox.setSingleStep(5) self.speedSpinBox.setValue(self.aw.qmc.backgroundmovespeed) curvenames = [ "" ] # first entry is the empty one, no extra curve displayed for i in range( min(len(self.aw.qmc.extraname1B), len(self.aw.qmc.extraname2B), len(self.aw.qmc.extratimexB))): curvenames.append("B" + str(2 * i + 3) + ": " + self.aw.qmc.extraname1B[i]) curvenames.append("B" + str(2 * i + 4) + ": " + self.aw.qmc.extraname2B[i]) self.xtcurvelabel = QLabel( QApplication.translate("Label", "Extra 1", None)) self.xtcurveComboBox = QComboBox() self.xtcurveComboBox.setToolTip( QApplication.translate( "Tooltip", "For loaded backgrounds with extra devices only", None)) self.xtcurveComboBox.setMinimumWidth(120) self.xtcurveComboBox.addItems(curvenames) if self.aw.qmc.xtcurveidx < len(curvenames): self.xtcurveComboBox.setCurrentIndex(self.aw.qmc.xtcurveidx) self.xtcurveComboBox.currentIndexChanged.connect(self.changeXTcurveidx) self.ytcurvelabel = QLabel( QApplication.translate("Label", "Extra 2", None)) self.ytcurveComboBox = QComboBox() self.ytcurveComboBox.setToolTip( QApplication.translate( "Tooltip", "For loaded backgrounds with extra devices only", None)) self.ytcurveComboBox.setMinimumWidth(120) self.ytcurveComboBox.addItems(curvenames) if self.aw.qmc.ytcurveidx < len(curvenames): self.ytcurveComboBox.setCurrentIndex(self.aw.qmc.ytcurveidx) self.ytcurveComboBox.currentIndexChanged.connect(self.changeYTcurveidx) self.upButton = QPushButton( QApplication.translate("Button", "Up", None)) self.upButton.setFocusPolicy(Qt.NoFocus) self.downButton = QPushButton( QApplication.translate("Button", "Down", None)) self.downButton.setFocusPolicy(Qt.NoFocus) self.leftButton = QPushButton( QApplication.translate("Button", "Left", None)) self.leftButton.setFocusPolicy(Qt.NoFocus) self.rightButton = QPushButton( QApplication.translate("Button", "Right", None)) self.rightButton.setFocusPolicy(Qt.NoFocus) self.backgroundCheck.clicked.connect(self.readChecks) self.backgroundDetails.clicked.connect(self.readChecks) self.backgroundeventsflag.clicked.connect(self.readChecks) self.backgroundDeltaETflag.clicked.connect(self.readChecks) self.backgroundDeltaBTflag.clicked.connect(self.readChecks) self.backgroundETflag.clicked.connect(self.readChecks) self.backgroundBTflag.clicked.connect(self.readChecks) self.backgroundFullflag.clicked.connect(self.readChecks) delButton.clicked.connect(self.delete) self.upButton.clicked.connect(self.moveUp) self.downButton.clicked.connect(self.moveDown) self.leftButton.clicked.connect(self.moveLeft) self.rightButton.clicked.connect(self.moveRight) #TAB 2 EVENTS #table for showing events self.eventtable = QTableWidget() self.eventtable.setTabKeyNavigation(True) self.createEventTable() self.copyeventTableButton = QPushButton( QApplication.translate("Button", "Copy Table", None)) self.copyeventTableButton.setToolTip( QApplication.translate( "Tooltip", "Copy table to clipboard, OPTION or ALT click for tabular text", None)) self.copyeventTableButton.setFocusPolicy(Qt.NoFocus) self.copyeventTableButton.setMaximumSize( self.copyeventTableButton.sizeHint()) self.copyeventTableButton.setMinimumSize( self.copyeventTableButton.minimumSizeHint()) self.copyeventTableButton.clicked.connect( self.copyEventTabletoClipboard) #TAB 3 DATA #table for showing data self.datatable = QTableWidget() self.datatable.setTabKeyNavigation(True) self.createDataTable() self.copydataTableButton = QPushButton( QApplication.translate("Button", "Copy Table", None)) self.copydataTableButton.setToolTip( QApplication.translate( "Tooltip", "Copy table to clipboard, OPTION or ALT click for tabular text", None)) self.copydataTableButton.setFocusPolicy(Qt.NoFocus) self.copydataTableButton.setMaximumSize( self.copydataTableButton.sizeHint()) self.copydataTableButton.setMinimumSize( self.copydataTableButton.minimumSizeHint()) self.copydataTableButton.clicked.connect(self.copyDataTabletoClipboard) #TAB 4 self.replayComboBox = QComboBox() replayVariants = [ QApplication.translate("Label", "by time", None), QApplication.translate("Label", "by BT", None), QApplication.translate("Label", "by ET", None), ] self.replayComboBox.addItems(replayVariants) self.replayComboBox.setCurrentIndex(self.aw.qmc.replayType) self.replayComboBox.currentIndexChanged.connect( self.changeReplayTypeidx) self.backgroundReproduce = QCheckBox( QApplication.translate("CheckBox", "Playback Aid", None)) self.backgroundReproduce.setChecked(self.aw.qmc.backgroundReproduce) self.backgroundReproduce.setFocusPolicy(Qt.NoFocus) self.backgroundReproduce.stateChanged.connect(self.setreproduce) self.backgroundReproduceBeep = QCheckBox( QApplication.translate("CheckBox", "Beep", None)) self.backgroundReproduceBeep.setChecked( self.aw.qmc.backgroundReproduce) self.backgroundReproduceBeep.setFocusPolicy(Qt.NoFocus) self.backgroundReproduceBeep.stateChanged.connect( self.setreproduceBeep) self.backgroundPlaybackEvents = QCheckBox( QApplication.translate("CheckBox", "Playback Events", None)) self.backgroundPlaybackEvents.setChecked( self.aw.qmc.backgroundPlaybackEvents) self.backgroundPlaybackEvents.setFocusPolicy(Qt.NoFocus) self.backgroundPlaybackEvents.stateChanged.connect( self.setplaybackevent) self.backgroundPlaybackDROP = QCheckBox( QApplication.translate("CheckBox", "Playback DROP", None)) self.backgroundPlaybackDROP.setChecked( self.aw.qmc.backgroundPlaybackDROP) self.backgroundPlaybackDROP.setFocusPolicy(Qt.NoFocus) self.backgroundPlaybackDROP.stateChanged.connect(self.setplaybackdrop) etimelabel = QLabel( QApplication.translate("Label", "Text Warning", None)) etimeunit = QLabel(QApplication.translate("Label", "sec", None)) self.etimeSpinBox = QSpinBox() self.etimeSpinBox.setRange(1, 60) self.etimeSpinBox.setValue(self.aw.qmc.detectBackgroundEventTime) self.etimeSpinBox.valueChanged.connect(self.setreproduce) self.clearBgbeforeprofileload = QCheckBox( QApplication.translate( "CheckBox", "Clear the background before loading a new profile", None)) self.clearBgbeforeprofileload.setChecked( self.aw.qmc.clearBgbeforeprofileload) self.clearBgbeforeprofileload.setFocusPolicy(Qt.NoFocus) self.clearBgbeforeprofileload.stateChanged.connect( self.optclearbgbeforeprofileload) self.hideBgafterprofileload = QCheckBox( QApplication.translate( "CheckBox", "Always hide background when loading a profile", None)) self.hideBgafterprofileload.setChecked( self.aw.qmc.hideBgafterprofileload) self.hideBgafterprofileload.setFocusPolicy(Qt.NoFocus) self.hideBgafterprofileload.stateChanged.connect( self.opthideBgafterprofileload) #LAYOUT MANAGERS movelayout = QGridLayout() movelayout.addWidget(self.upButton, 0, 1) movelayout.addWidget(self.leftButton, 1, 0) movelayout.addWidget(self.speedSpinBox, 1, 1) movelayout.addWidget(self.rightButton, 1, 2) movelayout.addWidget(self.downButton, 2, 1) movelayout.setSpacing(20) checkslayout1 = QHBoxLayout() checkslayout1.addStretch() checkslayout1.addWidget(self.backgroundCheck) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundDetails) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundeventsflag) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundETflag) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundBTflag) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundDeltaETflag) checkslayout1.addSpacing(3) checkslayout1.addWidget(backgroundDeltaETflagLabel) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundDeltaBTflag) checkslayout1.addSpacing(3) checkslayout1.addWidget(backgroundDeltaBTflagLabel) checkslayout1.addSpacing(5) checkslayout1.addWidget(self.backgroundFullflag) checkslayout1.addStretch() layout = QGridLayout() layoutBoxedH = QHBoxLayout() layoutBoxedH.addStretch() layoutBoxedH.addLayout(movelayout) layoutBoxedH.addLayout(layout) layoutBoxedH.addStretch() layoutBoxed = QVBoxLayout() layoutBoxed.addStretch() layoutBoxed.addLayout(checkslayout1) layoutBoxed.addStretch() layoutBoxed.addLayout(layoutBoxedH) layoutBoxed.addStretch() alignButtonBoxed = QHBoxLayout() alignButtonBoxed.addWidget(self.xtcurvelabel) alignButtonBoxed.addWidget(self.xtcurveComboBox) alignButtonBoxed.addSpacing(10) alignButtonBoxed.addWidget(self.ytcurvelabel) alignButtonBoxed.addWidget(self.ytcurveComboBox) alignButtonBoxed.addStretch() alignButtonBoxed.addWidget(alignButton) alignButtonBoxed.addWidget(self.alignComboBox) tab4content = QHBoxLayout() tab4content.addWidget(self.backgroundReproduce) tab4content.addSpacing(10) tab4content.addWidget(self.backgroundReproduceBeep) tab4content.addSpacing(10) tab4content.addWidget(etimelabel) tab4content.addWidget(self.etimeSpinBox) tab4content.addWidget(etimeunit) tab4content.addSpacing(20) tab4content.addStretch() tab4content.addWidget(self.backgroundPlaybackEvents) tab4content.addSpacing(10) tab4content.addWidget(self.backgroundPlaybackDROP) tab4content.addSpacing(10) tab4content.addWidget(self.replayComboBox) optcontent = QHBoxLayout() optcontent.addWidget(self.clearBgbeforeprofileload) optcontent.addStretch() optcontent.addWidget(self.hideBgafterprofileload) tab1layout = QVBoxLayout() tab1layout.addLayout(layoutBoxed) # tab1layout.addStretch() tab1layout.addLayout(alignButtonBoxed) tab1layout.addLayout(tab4content) tab1layout.addLayout(optcontent) tab1layout.setContentsMargins(5, 0, 5, 0) # left, top, right, bottom eventbuttonLayout = QHBoxLayout() eventbuttonLayout.addWidget(self.copyeventTableButton) eventbuttonLayout.addStretch() tab2layout = QVBoxLayout() tab2layout.addWidget(self.eventtable) tab2layout.addLayout(eventbuttonLayout) tab2layout.setContentsMargins(5, 0, 5, 0) # left, top, right, bottom databuttonLayout = QHBoxLayout() databuttonLayout.addWidget(self.copydataTableButton) databuttonLayout.addStretch() tab3layout = QVBoxLayout() tab3layout.addWidget(self.datatable) tab3layout.addLayout(databuttonLayout) tab3layout.setContentsMargins(5, 0, 5, 0) # left, top, right, bottom #tab layout tab1layout.setSpacing(5) self.TabWidget = QTabWidget() C1Widget = QWidget() C1Widget.setLayout(tab1layout) self.TabWidget.addTab(C1Widget, QApplication.translate("Tab", "Config", None)) C2Widget = QWidget() C2Widget.setLayout(tab2layout) self.TabWidget.addTab(C2Widget, QApplication.translate("Tab", "Events", None)) C3Widget = QWidget() C3Widget.setLayout(tab3layout) self.TabWidget.addTab(C3Widget, QApplication.translate("Tab", "Data", None)) buttonLayout = QHBoxLayout() buttonLayout.addWidget(loadButton) buttonLayout.addWidget(delButton) buttonLayout.addStretch() buttonLayout.addWidget(self.dialogbuttons) mainLayout = QVBoxLayout() mainLayout.addWidget(self.TabWidget) mainLayout.addWidget(self.pathedit) mainLayout.addLayout(buttonLayout) mainLayout.setContentsMargins(5, 10, 5, 5) # left, top, right, bottom self.setLayout(mainLayout) if platform.system() == 'Windows': self.dialogbuttons.button(QDialogButtonBox.Ok) else: self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus() self.TabWidget.setCurrentIndex(activeTab)
def initUI(self): self.statusBar().showMessage('Ready') self.image_window_view = HyperLprImageView() table_widget_header_labels = [ "文件名", "分割识别", "置信度", "颜色", "E2E识别", "E2E置信度" ] self.hyperlpr_tableview = QTableWidget(0, len(table_widget_header_labels)) self.hyperlpr_tableview.setHorizontalHeaderLabels( table_widget_header_labels) self.hyperlpr_tableview.setSelectionBehavior( QAbstractItemView.SelectItems) self.hyperlpr_tableview.setSelectionMode( QAbstractItemView.SingleSelection) self.hyperlpr_tableview.setEditTriggers( QAbstractItemView.NoEditTriggers) self.hyperlpr_tableview.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) self.hyperlpr_tableview.setEditTriggers( QAbstractItemView.NoEditTriggers) self.hyperlpr_tableview.cellClicked.connect( self.recognize_one_license_plate) self.location_label = QLabel("车牌目录", self) self.location_text = QLineEdit(self) self.location_text.setEnabled(False) self.location_text.setFixedWidth(300) self.location_button = QPushButton("...") self.location_button.clicked.connect(self.select_new_dir) self.location_layout = QHBoxLayout() self.location_layout.addWidget(self.location_label) self.location_layout.addWidget(self.location_text) self.location_layout.addWidget(self.location_button) self.location_layout.addStretch() self.check_box = QCheckBox("与文件名比较车牌") self.check_box.setChecked(True) self.update_file_path_button = QPushButton('批量识别') self.update_file_path_button.clicked.connect( self.batch_recognize_all_images) self.update_file_path_layout = QHBoxLayout() self.update_file_path_layout.addWidget(self.check_box) self.update_file_path_layout.addWidget(self.update_file_path_button) self.update_file_path_layout.addStretch() self.bottom_layout = QVBoxLayout() self.bottom_layout.addLayout(self.location_layout) self.bottom_layout.addLayout(self.update_file_path_layout) bottom_widget = QWidget() bottom_widget.setLayout(self.bottom_layout) license_plate_iamge_label = QLabel("车牌图") self.license_plate_widget = QLabel("") block_image_label = QLabel("分割图") self.block_plate_widget = QLabel("") filename_label = QLabel("文件名:") self.filename_edit = QLineEdit() segmentation_recognition_label = QLabel("分割识别:") self.segmentation_recognition_edit = QLineEdit() self.segmentation_recognition_edit.setFont(QFont("黑体", 24, QFont.Bold)) self.segmentation_recognition_edit.setStyleSheet("color:red") confidence_label = QLabel("置信度") self.confidence_edit = QLineEdit() self.confidence_edit.setFont(QFont("黑体", 24, QFont.Bold)) self.confidence_edit.setStyleSheet("color:red") plate_color_label = QLabel("车牌颜色") self.plate_color_edit = QLineEdit() self.plate_color_edit.setFont(QFont("黑体", 24, QFont.Bold)) self.plate_color_edit.setStyleSheet("color:red") e2e_recognization_label = QLabel("e2e识别:") self.e2e_recognization_edit = QLineEdit() self.e2e_recognization_edit.setFont(QFont("黑体", 24, QFont.Bold)) self.e2e_recognization_edit.setStyleSheet("color:red") e2e_confidence_label = QLabel("e2e置信度") self.e2e_confidence_edit = QLineEdit() self.e2e_confidence_edit.setFont(QFont("黑体", 24, QFont.Bold)) self.e2e_confidence_edit.setStyleSheet("color:red") info_gridlayout = QGridLayout() info_gridlayout.addWidget(filename_label, 0, 0) info_gridlayout.addWidget(self.filename_edit, 0, 1) info_gridlayout.addWidget(license_plate_iamge_label, 1, 0) info_gridlayout.addWidget(self.license_plate_widget, 1, 1) info_gridlayout.addWidget(block_image_label, 2, 0) info_gridlayout.addWidget(self.block_plate_widget, 2, 1) info_gridlayout.addWidget(segmentation_recognition_label, 3, 0) info_gridlayout.addWidget(self.segmentation_recognition_edit, 3, 1) info_gridlayout.addWidget(confidence_label, 4, 0) info_gridlayout.addWidget(self.confidence_edit, 4, 1) info_gridlayout.addWidget(plate_color_label, 5, 0) info_gridlayout.addWidget(self.plate_color_edit, 5, 1) info_gridlayout.addWidget(e2e_recognization_label, 6, 0) info_gridlayout.addWidget(self.e2e_recognization_edit, 6, 1) info_gridlayout.addWidget(e2e_confidence_label, 7, 0) info_gridlayout.addWidget(self.e2e_confidence_edit, 7, 1) info_widget = QWidget() info_widget.setLayout(info_gridlayout) right_splitter = QSplitter(Qt.Vertical) right_splitter.addWidget(bottom_widget) right_splitter.addWidget(self.hyperlpr_tableview) right_splitter.addWidget(info_widget) right_splitter.setStretchFactor(1, 3) right_splitter.setStretchFactor(2, 2) main_splitter = QSplitter(Qt.Horizontal) main_splitter.addWidget(self.image_window_view) main_splitter.addWidget(right_splitter) main_splitter.setStretchFactor(0, 1) self.image_filename_list = [] self.hyperlpr_dir_path = "" self.segmentation_recognition_correct_number = 0 self.color_correct_number = 0 self.e2e_recognization_correct_number = 0 self.batch_recognization_thread = LicenseRecognizationThread() self.batch_recognization_thread.recognization_done_signal.connect( self.recognization_done_slot) self.batch_recognization_thread.start() self.start_init_signal.connect(self.read_path_and_show_one_image) self.setCentralWidget(main_splitter) self.setWindowTitle("HyperLPR车牌识别软件v1.0") self.start_init_signal.emit()
def interfejs(self): self.currentBuingIndex = 0 self.currentSaleIndex = 0 #PyQt5 - dodanie etykiet aplikacji labelBuying = QLabel("Kupno:", self) labelSale = QLabel("Sprzedaż:", self) labelAmount = QLabel("Ilość:", self) labelRate = QLabel("Aktualne kursy:", self) labelRateAmount = QLabel("Po wymianie otrzymasz:", self) #Przypisanie dodanych widgetów (etykiet) do układu tabelarycznego QGridLayout layoutTable = QGridLayout() layoutTable.addWidget(labelBuying, 0, 0) layoutTable.addWidget(labelSale, 0, 1) layoutTable.addWidget(labelAmount, 0, 2) layoutTable.addWidget(labelRate, 0, 4) layoutTable.addWidget(labelRateAmount, 3, 0) #Przypisanie utworzonego układu do layoutu aplikacji self.setLayout(layoutTable) #Określenie podstawowych parametrów okna aplikacji self.setGeometry(100, 100, 100, 100) self.setWindowIcon(QIcon('1.png')) self.setWindowTitle("Kantor walutowy") self.setStyleSheet("color: #1a1a1a;" "background-color: white;" "selection-color: black;" "selection-background-color: #c9fb0f;" "font: 15px;") #PyQt5 - dodanie selectów self.comboBuing = QComboBox() self.comboSale = QComboBox() #Pętla dodająca do selectów nazwy walut - z tablicy currencyRate for i in range(len(currencyRate)): self.comboBuing.addItem(currencyRate[i][0]) self.comboSale.addItem(currencyRate[i][0]) #Połączenie kliknięcia elementów z metodami self.comboBuing.currentIndexChanged.connect(self.selectionBuingChange) self.comboSale.currentIndexChanged.connect(self.selectionSaleChange) #PyQt5 - dodanie pól edycyjnych self.moneyAmount = QLineEdit() self.inputResult = QLineEdit() self.inputResult.setToolTip( '<b>Wpisz kwotę, którą chcesz wymienić</b>') #Dodawanie do układu layoutu stworzonych elementów layoutTable.addWidget(self.comboBuing, 1, 0) layoutTable.addWidget(self.comboSale, 1, 1) layoutTable.addWidget(self.moneyAmount, 1, 2) layoutTable.addWidget(self.inputResult, 4, 0) #PyQt5 - dodanie przycisków i powiązań ich z metodami buttonResult = QPushButton("&OBLICZ", self) buttonResult.clicked.connect(self.calculate) buttonResult.setStyleSheet( "color: black;" "background-color: #c9fb0f;" "selection-color: yellow;" "font: bold 15px;" "border: 1px solid #c9fb0f;" "border-radius: 6px;" "background-color: qlineargradient(x1: 1, y1: 1, x2: 0, y2: 0, stop: 0 #c9fb0f, stop: 1 #a7d108);" "padding-top: 10px;" "padding-bottom: 10px;") buttonEnd = QPushButton("&Zakończ działanie programu", self) buttonEnd.resize(buttonEnd.sizeHint()) buttonEnd.clicked.connect(self.endAction) buttonEnd.setStyleSheet( "color: black;" "background-color: #c9fb0f;" "font: bold 15px;" "border: 1px solid #c9fb0f;" "border-radius: 6px;" "background-color: qlineargradient(x1: 1, y1: 1, x2: 0, y2: 0, stop: 0 #c9fb0f, stop: 1 #a7d108);" "padding: 7px;") buttonSaveFile = QPushButton("&Zapisz kursy do pliku csv", self) buttonSaveFile.clicked.connect(self.saveFile) buttonSaveFile.setStyleSheet( "color: black;" "font: bold 15px;" "border: 1px solid #899cf0;" "border-radius: 6px;" "background-color: qlineargradient(x1: 1, y1: 1, x2: 0, y2: 0, stop: 0 #899cf0, stop: 1 #5c76ea);" "padding: 7px;") layoutTableH = QHBoxLayout() layoutTableH.addWidget(buttonResult) layoutTable.addLayout(layoutTableH, 2, 0, 1, 3) layoutTable.addWidget(buttonEnd, 15, 30, 1, 2) layoutTable.addWidget(buttonSaveFile, 15, 28, 1, 2) #Wyświetlenie okna aplikacji na ekranie self.show() #PyQt5 - dodanie tabeli z danymi kursów self.tableRates = QTableWidget() self.tableRates.setRowCount(32) self.tableRates.setColumnCount(5) #Określenie nazw kolumn tabeli self.tableRates.setHorizontalHeaderLabels( ['Nazwa waluty', 'Państwo', 'Symbol', 'Średni kurs', 'Zmiana %']) #Pętla w pętli dodająca kolejne komórki tabeli z danych umieszczonych w tablicy currencyRate for i in range(len(currencyRate) - 1): for j in range(5): self.tableRates.setItem(i, j, QTableWidgetItem(currencyRate[i][j])) #Sprawdzanie czy dodawane są wartości z kolumny nr 4 - Zmiana % if (j == 4): #sprawdzanie czy zmiana procentowa była >= 0 i kolorowanie tej komórki na zielono if (float(currencyRate[i][j].replace("%", "")) >= 0): self.tableRates.item(i, j).setBackground( QtGui.QColor(53, 229, 57)) #sprawdzanie czy zmiana procentowa była < 0 i kolorowanie tej komórki na czerwono else: self.tableRates.item(i, j).setBackground( QtGui.QColor(229, 57, 53)) layoutTable.addWidget(self.tableRates, 1, 4, 10, 28)
def showCustomer(list): #initialize attributes cid = 0 gender = "" storeid = "" age = "" name = "" address = "" mobile = -1 #defining values from list cid = list[0] name = list[1] if list[2] == 0: gender = "Male" else: gender = "Female" if list[3] == 0: storeid = "Store 0" elif list[3] == 1: storeid = "Store 1" elif list[3] == 2: storeid = "Store 2" elif list[3] == 3: storeid = "Store 3" elif list[3] == 4: storeid = "Store 4" elif list[3] == 5: storeid = "Store 5" age = list[4] address = list[5] mobile = list[6] #creating a PyQt table and passing in the labels,values in x,y grid form table = QTableWidget() table.setWindowTitle("Customer Details") #setting table dimensions table.setRowCount(7) table.setColumnCount(2) #adding labels, values as widget items in x,y form table.setItem(0, 0, QTableWidgetItem("Cid")) table.setItem(0, 1, QTableWidgetItem(str(cid))) table.setItem(1, 0, QTableWidgetItem("Name")) table.setItem(1, 1, QTableWidgetItem(str(name))) table.setItem(2, 0, QTableWidgetItem("Gender")) table.setItem(2, 1, QTableWidgetItem(str(gender))) table.setItem(3, 0, QTableWidgetItem("Store Id")) table.setItem(3, 1, QTableWidgetItem(str(storeid))) table.setItem(4, 0, QTableWidgetItem("Age")) table.setItem(4, 1, QTableWidgetItem(str(age))) table.setItem(5, 0, QTableWidgetItem("Address")) table.setItem(5, 1, QTableWidgetItem(str(address))) table.setItem(6, 0, QTableWidgetItem("Mobile")) table.setItem(6, 1, QTableWidgetItem(str(mobile))) table.horizontalHeader().setStretchLastSection(True) table.show() #initilize dialog box and add table widget dialog = QDialog() dialog.setWindowTitle("Customer Details") dialog.resize(500, 300) dialog.setLayout(QVBoxLayout()) dialog.layout().addWidget(table) dialog.exec()
def initUI(self): self.labels = ['data ora','origine','destinazione','tipo messaggio','payload','utente', \ 'da_id','a_id','altitudine','latitudine','longitudine','rxSnr','distanza','rilevamento'] self.labels1 = ['data ora','user','altitudine','latitudine','longitudine','batteria%', \ 'rxsnr','distanza','rilevamento'] self.csvFile = open('meshtastic_data.csv','wt') mylatlbl = QLabel("Home lat:") mylonlbl = QLabel("Home lon:") voidlbl = QLabel("") voidlbl.setMinimumWidth(320) self.mylat = QLineEdit() self.mylon = QLineEdit() #mylatlbl.setMaximumWidth(60) #mylonlbl.setMaximumWidth(60) mapbtn = QPushButton("SHOW MAP",self) #mapbtn.setMaximumWidth(110) self.radiob = QRadioButton('Storico giorno:') #self.setMaximumWidth(100) self.combobox = QComboBox(self) self.combobox.setMinimumWidth(90) fra = QLabel("fra") self.fragiorno = QLineEdit() self.fragiorno.setText('21/01/01') #self.fragiorno.setMaximumSize(70,24) et = QLabel("e") self.egiorno = QLineEdit() oggi = datetime.datetime.now().strftime("%y/%m/%d") self.egiorno.setText(oggi) #self.egiorno.setMaximumSize(70,24) mapbtn.clicked.connect(self.showMap) #self.mylat.setMaximumWidth(80) #self.mylon.setMaximumWidth(80) self.mylat.setText('45.641174') self.mylon.setText('9.114828') lblmap = QLabel("Tipo Map") self.combomap = QComboBox(self) self.combomap.addItem("OpenStreetMap") # self.combomap.addItem("Mapbox Bright") self.combomap.addItem('Stamen Terrain') self.combomap.addItem("Stamen Toner") self.combomap.addItem("CartoDB positron") self.combomap.addItem("CartoDB dark_matter") hhome = QHBoxLayout() hhome.addWidget(mylatlbl) hhome.addWidget(self.mylat) hhome.addWidget(mylonlbl) hhome.addWidget(self.mylon) hhome.addWidget(mapbtn) hhome.addWidget(self.radiob) hhome.addWidget(self.combobox) hhome.addWidget(fra) hhome.addWidget(self.fragiorno) hhome.addWidget(et) hhome.addWidget(self.egiorno) hhome.addWidget(lblmap) hhome.addWidget(self.combomap) hhome.addWidget(voidlbl) self.layout = QVBoxLayout(self) self.setWindowTitle(self.title) self.tabs = QTabWidget() self.tab1 = QWidget() self.tab2 = QWidget() self.tab3 = QWidget() self.inText = QLineEdit() self.inText.setMaximumWidth(250) self.inText.setText("cq de I1LOZ") label2 = QLabel("Dati inviati: ") label2.setMaximumWidth(70) self.rbtn1 = QCheckBox('Solo ricezione') self.rbtn2 = QCheckBox('Genera csv file') self.rbtn1.setMaximumWidth(150) self.rbtn2.setMinimumWidth(600) startb = QPushButton("START",self) startb.clicked.connect(self.start_click) hbox = QHBoxLayout() hbox.addWidget(startb) hbox.addWidget(label2) hbox.addWidget(self.inText) hbox.addWidget(self.rbtn1) hbox.addWidget(self.rbtn2) # Add tabs self.tabs.addTab(self.tab1,"Messaggi") self.tabs.addTab(self.tab2,"Connessi") self.tabs.addTab(self.tab3,"GeoMap") self.table = QTableWidget() self.table.setColumnCount(len(self.labels)) self.table.setHorizontalHeaderLabels(self.labels) self.tab1.layout = QVBoxLayout() self.tab1.layout.addWidget(self.table) self.tab1.setLayout(self.tab1.layout) self.table1 = QTableWidget() self.table1.setColumnCount(len(self.labels1)) self.table1.setHorizontalHeaderLabels(self.labels1) self.tab2.layout = QVBoxLayout() self.tab2.layout.addWidget(self.table1) self.tab2.setLayout(self.tab2.layout) label = QLabel("Log dati ricevuti") self.log = QTextEdit() self.log.setMaximumHeight(180) self.rbtn2.clicked.connect(self.handleFile) self.layout.addLayout(hhome) self.layout.addWidget(self.tabs) self.layout.addWidget(label) self.layout.addWidget(self.log) self.layout.addLayout(hbox) self.setGeometry(100, 50, 1200,640) self.show()
def __init__(self, parent): global wallet_table super().__init__(parent) self.setTitle(_("Select Wallet")) self.setButtonText(QWizard.NextButton, _("&Add Wallet")) self.setFinalPage(True) wallet_data = self._get_recently_opened_wallets() locked_pixmap = QPixmap(icon_path("icons8-lock-80.png")).scaledToWidth( 40, Qt.SmoothTransformation) unlocked_pixmap = QPixmap( icon_path("icons8-unlock-80.png")).scaledToWidth( 40, Qt.SmoothTransformation) layout = QVBoxLayout() wallet_table = self.wallet_table = QTableWidget() wallet_table.setColumnCount(1) #wallet_table.setIconSize(QSize(24, 24)) wallet_table.setHorizontalHeaderLabels(["Recently Opened Wallets"]) wallet_table.setSelectionBehavior(QAbstractItemView.SelectRows) wallet_table.setStyleSheet(""" QTableView { selection-background-color: #F5F8FA; } QHeaderView::section { font-weight: bold; } """) # Tab by default in QTableWidget, moves between list items. The arrow keys also perform # the same function, and we want tab to allow toggling to the wizard button bar instead. wallet_table.setTabKeyNavigation(False) hh = wallet_table.horizontalHeader() hh.setStretchLastSection(True) vh = wallet_table.verticalHeader() vh.setSectionResizeMode(QHeaderView.ResizeToContents) vh.hide() for d in wallet_data: wallet_path = d['path'] wallet_storage = WalletStorage(wallet_path, manual_upgrades=True) row_index = wallet_table.rowCount() wallet_table.insertRow(row_index) row_widget = QWidget() row_layout = QHBoxLayout() row_layout.setSpacing(0) row_layout.setContentsMargins(0, 0, 0, 0) row_icon_label = QLabel() if wallet_storage.is_encrypted(): row_icon_label.setPixmap(locked_pixmap) else: row_icon_label.setPixmap(unlocked_pixmap) row_icon_label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) row_icon_label.setMaximumWidth(80) row_desc_label = QLabel(d['name']) row_layout.addWidget(row_icon_label) row_layout.addWidget(row_desc_label) row_widget.setLayout(row_layout) wallet_table.setCellWidget(row_index, 0, row_widget) self.wallet_data = wallet_data layout.addWidget(wallet_table) self.setLayout(layout) wallet_table.setFocus() wallet_table.selectRow(0)
def initUI(self): fuenteSiacle = self.font() fuenteSiacle.setBold(True) fuenteSiacle.setPointSize(12) # ================= FRAME PANEL DE CONTROL =================== paletaBotones = self.palette() paletaBotones.setColor(QPalette.Background, QColor("#2EFEC8")) frameBotones = QFrame() frameBotones.setFrameStyle(QFrame.NoFrame) frameBotones.setAutoFillBackground(True) frameBotones.setPalette(paletaBotones) frameBotones.setFixedWidth(220) # ============================================================ paletaPanel = self.palette() paletaPanel.setBrush(QPalette.Background, QBrush(QColor(255, 90, 0), Qt.SolidPattern)) paletaPanel.setColor(QPalette.Foreground, Qt.white) labelSiacle = QLabel("PANEL DE CONTROL", frameBotones) labelSiacle.setAlignment(Qt.AlignCenter | Qt.AlignVCenter) labelSiacle.setFont(fuenteSiacle) labelSiacle.setAutoFillBackground(True) labelSiacle.setPalette(paletaPanel) labelSiacle.setFixedSize(220, 46) labelSiacle.move(0, 0) # ============================================================ tamanioIcono = QSize(30, 30) botonNuevo = Boton(frameBotones) botonNuevo.setText(" Nuevo") botonNuevo.setToolTip("Nuevo cliente") botonNuevo.setCursor(Qt.PointingHandCursor) botonNuevo.move(-2, 45) botonActualizar = Boton(frameBotones) botonActualizar.setText(" Actualizar") botonActualizar.setToolTip("Actualizar cliente") botonActualizar.setCursor(Qt.PointingHandCursor) botonActualizar.move(-2, 82) botonEliminar = Boton(frameBotones) botonEliminar.setText(" Eliminar") botonEliminar.setToolTip("Eliminar cliente") botonEliminar.setCursor(Qt.PointingHandCursor) botonEliminar.move(-2, 119) botonLimpiar = Boton(frameBotones) botonLimpiar.setText(" Limpiar tabla") botonLimpiar.setToolTip("Limpiar tabla") botonLimpiar.setCursor(Qt.PointingHandCursor) botonLimpiar.move(-2, 156) # ============================================================ paletaSuscribete = self.palette() paletaSuscribete.setBrush( QPalette.Background, QBrush(QColor(135, 206, 250), Qt.SolidPattern)) fuenteSuscribete = self.font() fuenteSuscribete.setBold(True) fuenteSuscribete.setFamily("Arial") fuenteSuscribete.setPointSize(11) labelSuscribete = QLabel( "<a href='https://www.youtube.com/c/AndresNiñoPython?" "sub_confirmation=1'>SUSCRIBETE.</a>", frameBotones) labelSuscribete.setAlignment(Qt.AlignCenter | Qt.AlignVCenter) labelSuscribete.setOpenExternalLinks(True) labelSuscribete.setFont(fuenteSuscribete) labelSuscribete.setAutoFillBackground(True) labelSuscribete.setPalette(paletaSuscribete) labelSuscribete.setFixedSize(220, 46) labelSuscribete.move(0, 210) # ============ FRAME BIENVENIDO - CONFIGURACIÓN ============== paletaFrame = self.palette() paletaFrame.setColor(QPalette.Background, QColor("blue")) frameBienvenido = QFrame() frameBienvenido.setFrameStyle(QFrame.NoFrame) frameBienvenido.setAutoFillBackground(True) frameBienvenido.setPalette(paletaFrame) frameBienvenido.setFixedHeight(46) # ============================================================ paletaTitulo = self.palette() paletaTitulo.setColor(QPalette.Foreground, Qt.yellow) labelBienvenido = QLabel("BIENVENIDO A SIACLE") labelBienvenido.setAlignment(Qt.AlignCenter) labelBienvenido.setFont(fuenteSiacle) labelBienvenido.setPalette(paletaTitulo) botonConfiguracion = QPushButton() botonConfiguracion.setIcon(QIcon("Imagenes/configuracion.png")) botonConfiguracion.setIconSize(QSize(24, 24)) botonConfiguracion.setToolTip("Configurar Siacle") botonConfiguracion.setCursor(Qt.PointingHandCursor) botonConfiguracion.setFixedWidth(36) disenioFrame = QHBoxLayout() disenioFrame.addWidget(labelBienvenido, Qt.AlignCenter) disenioFrame.addStretch() disenioFrame.addWidget(botonConfiguracion) disenioFrame.setContentsMargins(0, 0, 5, 0) frameBienvenido.setLayout(disenioFrame) # ============================================================ self.buscarLineEdit = QLineEdit() self.buscarLineEdit.setObjectName("Enter") self.buscarLineEdit.setPlaceholderText("Nombre del cliente") self.buscarLineEdit.setMinimumSize(200, 26) botonBuscar = QPushButton("Buscar") botonBuscar.setObjectName("Buscar") botonBuscar.setCursor(Qt.PointingHandCursor) botonBuscar.setMinimumSize(60, 26) separadorTodos = QFrame() separadorTodos.setFrameShape(QFrame.VLine) separadorTodos.setFrameShadow(QFrame.Raised) separadorTodos.setFixedSize(1, 26) botonTodos = QPushButton("Todos") botonTodos.setObjectName("Todos") botonTodos.setCursor(Qt.PointingHandCursor) botonTodos.setMinimumSize(60, 26) nombreColumnas = ("Id", "Nombre", "Apellido", "Sexo", "Fecha de nacimiento", "País", "Teléfono o celular") menuMostrarOcultar = QMenu() for indice, columna in enumerate(nombreColumnas, start=0): accion = QAction(columna, menuMostrarOcultar) accion.setCheckable(True) accion.setChecked(True) accion.setData(indice) menuMostrarOcultar.addAction(accion) botonMostrarOcultar = QPushButton("Motrar/ocultar columnas") botonMostrarOcultar.setCursor(Qt.PointingHandCursor) botonMostrarOcultar.setMenu(menuMostrarOcultar) botonMostrarOcultar.setMinimumSize(180, 26) disenioBuscar = QHBoxLayout() disenioBuscar.setSpacing(10) disenioBuscar.addWidget(self.buscarLineEdit) disenioBuscar.addWidget(botonBuscar) disenioBuscar.addWidget(separadorTodos) disenioBuscar.addWidget(botonTodos) disenioBuscar.addWidget(botonMostrarOcultar) # =================== WIDGET QTableWidget =================== self.tabla = QTableWidget() # Deshabilitar edición self.tabla.setEditTriggers(QAbstractItemView.NoEditTriggers) # Deshabilitar el comportamiento de arrastrar y soltar self.tabla.setDragDropOverwriteMode(False) # Seleccionar toda la fila self.tabla.setSelectionBehavior(QAbstractItemView.SelectRows) # Seleccionar una fila a la vez self.tabla.setSelectionMode(QAbstractItemView.SingleSelection) # Especifica dónde deben aparecer los puntos suspensivos "..." cuando se muestran # textos que no encajan self.tabla.setTextElideMode(Qt.ElideRight) # Qt.ElideNone # Establecer el ajuste de palabras del texto self.tabla.setWordWrap(False) # Deshabilitar clasificación self.tabla.setSortingEnabled(False) # Establecer el número de columnas self.tabla.setColumnCount(7) # Establecer el número de filas self.tabla.setRowCount(0) # Alineación del texto del encabezado self.tabla.horizontalHeader().setDefaultAlignment(Qt.AlignHCenter | Qt.AlignVCenter | Qt.AlignCenter) # Deshabilitar resaltado del texto del encabezado al seleccionar una fila self.tabla.horizontalHeader().setHighlightSections(False) # Hacer que la última sección visible del encabezado ocupa todo el espacio disponible self.tabla.horizontalHeader().setStretchLastSection(True) # Ocultar encabezado vertical self.tabla.verticalHeader().setVisible(False) # Dibujar el fondo usando colores alternados self.tabla.setAlternatingRowColors(True) # Establecer altura de las filas self.tabla.verticalHeader().setDefaultSectionSize(20) # self.tabla.verticalHeader().setHighlightSections(True) # Establecer las etiquetas de encabezado horizontal usando etiquetas self.tabla.setHorizontalHeaderLabels(nombreColumnas) # Menú contextual self.tabla.setContextMenuPolicy(Qt.CustomContextMenu) self.tabla.customContextMenuRequested.connect(self.menuContextual) # Establecer ancho de las columnas for indice, ancho in enumerate((80, 240, 240, 140, 150, 130), start=0): self.tabla.setColumnWidth(indice, ancho) # ============================================================ disenioBuscarTabla = QVBoxLayout() disenioBuscarTabla.addLayout(disenioBuscar) disenioBuscarTabla.addWidget(self.tabla) disenioBuscarTabla.setSpacing(8) disenioBuscarTabla.setContentsMargins(10, 10, 10, 0) # ===================== LAYOUT DERECHO ======================= disenioDerecho = QVBoxLayout() disenioDerecho.addWidget(frameBienvenido) disenioDerecho.addLayout(disenioBuscarTabla) disenioDerecho.setContentsMargins(0, 0, 0, 0) # ====================== LAYOUT FINAL ====================== disenioFinal = QGridLayout() disenioFinal.addWidget(frameBotones, 0, 0) disenioFinal.addLayout(disenioDerecho, 0, 1) disenioFinal.setSpacing(0) disenioFinal.setContentsMargins(0, 0, 0, 0) self.setLayout(disenioFinal) # ========= GUARDAR INFORMACIÓN EN EL PORTAPAPELES ========= self.copiarInformacion = QApplication.clipboard() # ======================== EVENTOS ========================= botonNuevo.clicked.connect(self.Nuevo) botonActualizar.clicked.connect(self.Actualizar) botonEliminar.clicked.connect(self.Eliminar) botonLimpiar.clicked.connect(self.limpiarTabla) self.buscarLineEdit.returnPressed.connect(self.Buscar) botonBuscar.clicked.connect(self.Buscar) botonTodos.clicked.connect(self.Buscar) botonConfiguracion.clicked.connect(lambda: Configuracion(self).exec_()) self.tabla.itemDoubleClicked.connect(self.Suscribete) menuMostrarOcultar.triggered.connect(self.mostrarOcultar)
def initUi(self): horizontalHeader = ["工号", "姓名", "性别", "年龄", "职称"] self.table = QTableWidget() # 也可以QTableWidget(5,2) self.table.setColumnCount(5) # 5列 self.table.setRowCount(2) # 3行 # 隐藏垂直的表头,self.table.verticalHeader().setVisible(False) self.table.setHorizontalHeaderLabels(horizontalHeader) # 水平表头,垂直表头setVerticalHeaderLabels() # 表格中的数据,默认只要双击就可以修改其中的数据。 # 如果文档是处于预览状态或者不可编辑状态,那就需要对表格设定为不可编辑模式。 # QTableWidget.NoEditTriggers 0 不能对表格内容进行修改 # QTableWidget.CurrentChanged 1 任何时候都能对单元格修改 # QTableWidget.DoubleClicked 2 双击单元格 # QTableWidget.SelectedClicked 4 单击已选中的内容 # QTableWidget.EditKeyPressed 8 编辑键被按下时,编辑开始 # QTableWidget.AnyKeyPressed 16 按下任意键就能修改 # QTableWidget.AllEditTriggers 31 以上条件全包括 self.table.setEditTriggers(QTableWidget.NoEditTriggers) # QTableWidget.SelectItems 0 选中单个单元格 # QTableWidget.SelectRows 1 选中一行 # QTableWidget.SelectColumns 2 选中一列 self.table.setSelectionBehavior(QTableWidget.SelectColumns) # 设定的选择模式: # QTableWidget.NoSelection 不能选择 # QTableWidget.SingleSelection 选中单个目标 # QTableWidget.MultiSelection 选中多个目标 # QTableWidget.ExtendedSelection shift键的连续选择 # QTableWidget.ContiguousSelection ctrl键的不连续的多个选择 self.table.setSelectionMode(QTableWidget.SingleSelection) # 表头也是由多个item构成的,所以通过循环操作对每一个item进行操作 for index in range(self.table.columnCount()): headItem = self.table.horizontalHeaderItem(index) headItem.setFont(QFont("song", 12, QFont.Bold)) headItem.setForeground(QBrush(Qt.gray)) # 单元格对齐方式: # 水平方向: # Qt.AlignLeft 0x000 左对齐 # Qt.AlignRight 0x0002 右对齐 # Qt.AlignHCenter 0x0004 居中对齐 # Qt.AlignJustify 0x0008 # 垂直方向: # Qt.AlignTop 0x0020 上对齐 # Qt.AlignBottom 0x0040 下对齐 # Qt.AlignVCenter 0x0080 居中 headItem.setTextAlignment(0x000 | Qt.AlignVCenter) # 根据内容自动调整单元格大小 # self.table.resizeColumnsToContents() # self.table.resizeRowsToContents() self.table.setColumnWidth(4, 200) # 设置第5列宽度200 self.table.setRowHeight(0, 40) # 设置第一行高度40 # self.table.setFrameShape(QFrame.HLine)#设定样式 # self.table.setShowGrid(False) # False不显示网格线,True显示网格线 # 添加内容 self.table.setItem(0, 0, QTableWidgetItem("001")) self.table.setItem(0, 1, QTableWidgetItem("Tom")) # 表项——添加自定义控件 genderComb = QComboBox() genderComb.addItem("男性") genderComb.addItem("女性") genderComb.setCurrentIndex(0) self.table.setCellWidget(0, 2, genderComb) self.table.setItem(0, 3, QTableWidgetItem("30")) self.table.setItem(0, 4, QTableWidgetItem("产品经理")) self.table.setItem(1, 0, QTableWidgetItem("005")) self.table.setItem(1, 1, QTableWidgetItem("Kitty")) genderComb = QComboBox() genderComb.addItem("男性") genderComb.addItem("女性") genderComb.setCurrentIndex(1) self.table.setCellWidget(1, 2, genderComb) self.table.setItem(1, 3, QTableWidgetItem("24")) self.table.setItem(1, 4, QTableWidgetItem("程序猿安慰师")) # 动态插入行列 insertColumn()插入列 row_count = self.table.rowCount() self.table.insertRow(row_count) # 动态移除行列 # removeColumn(int column) 移除column列及其内容。 # removeRow(int row)移除第row行及其内容。 # row_count = self.table.rowCount() # self.table.removeRow(row_count-1) # clear() 清除所有表项及表头 # setSpan(int , int , int , int ),合并单元格 # 获取单元格内容: # self.tableWidget.item(rowindex, colindex).text() mainLayout = QHBoxLayout() mainLayout.addWidget(self.table) self.setLayout(mainLayout)
def dibujar_IU(self): self.setWindowTitle("Ingreso de Asociación") self.setWindowModality(Qt.ApplicationModal) self.setSizeGripEnabled(False) self.setContentsMargins(10, 10, 10, 10) self.id = QLineEdit() self.nombre = QLineEdit() self.empresas = QTableWidget(0, 6) self.facturacion_media_anual = QLineEdit() self.recursos_financieros = QLineEdit() self.cantidad_empresas = QLabel("0") self.espacio = QLabel("") self.total_facturacion_media_anual = QLabel("0.000") self.total_recursos_financieros = QLabel("0.000") self.total_experiencia = QLabel("0.000") self.id_error = QLabel("*") self.nombre_error = QLabel("*") self.empresas_error = QLabel("*") self.espaciador = QLabel(" ") self.id.setValidator(QIntValidator(1, 999)) self.id.setAlignment(Qt.AlignRight) self.id.setMaximumWidth(100) self.id.textChanged.connect(self.marcar_id_erroneo) self.id.setToolTip( "Identificador único de asociacón en todo el sistema") #self.nombre.setAlignment(Qt.AlignRight) self.nombre.setMaximumWidth(250) self.nombre.textChanged.connect(self.marcar_nombre_erroneo) self.nombre.setToolTip("Nombre con el que se la conoce") self.empresas.setHorizontalHeaderLabels([ "Id", "Nombre", "Facturación Media Anual", "Recursos Financieros", "Experiencia", "Oculto" ]) self.empresas.verticalHeader().setVisible(False) self.empresas.horizontalHeader().setSectionResizeMode( QHeaderView.Fixed) self.empresas.horizontalHeader().setDefaultAlignment(Qt.AlignLeft) self.empresas.horizontalHeader().hideSection(5) self.empresas.setSelectionMode(QAbstractItemView.SingleSelection) self.empresas.setSelectionBehavior(QAbstractItemView.SelectRows) self.empresas.resizeColumnsToContents() self.empresas.setColumnWidth(0, self.empresas.columnWidth(0) + 10) self.empresas.setColumnWidth(1, self.empresas.columnWidth(1) + 150) self.empresas.setColumnWidth(3, self.empresas.columnWidth(2)) self.empresas.setColumnWidth(4, self.empresas.columnWidth(2)) self.empresas.resize(self.empresas.sizeHint()) self.empresas.setSizeAdjustPolicy( QAbstractScrollArea.AdjustToContentsOnFirstShow) self.empresas.setFixedHeight(self.empresas.height()) self.empresas.setEditTriggers(QAbstractItemView.NoEditTriggers) self.empresas.cellChanged.connect(self.marcar_empresas_erroneas) self.empresas.setToolTip("Empresas que la componen") self.empresas.doubleClicked.connect(self.editar_empresa) self.cantidad_empresas.setFixedWidth(self.empresas.columnWidth(0)) self.espacio.setFixedWidth(self.empresas.columnWidth(1)) self.id_error.setStyleSheet("QLabel {color : red}") self.id_error.setVisible(False) self.id_error.setFixedWidth(10) self.nombre_error.setStyleSheet("QLabel {color : red}") self.nombre_error.setVisible(False) self.nombre_error.setFixedWidth(10) self.empresas_error.setStyleSheet("QLabel {color : red}") self.empresas_error.setVisible(False) self.empresas_error.setFixedWidth(10) boton_confirmar = QPushButton(QIcon("iconos/check.png"), "") boton_confirmar.clicked.connect(self.accept) boton_confirmar.setDefault(True) boton_confirmar.setMinimumSize(50, 10) boton_cancelar = QPushButton(QIcon("iconos/cancel.png"), "") boton_cancelar.clicked.connect(self.reject) boton_cancelar.setMinimumSize(50, 10) boton_agregar_empresa = QPushButton(QIcon("iconos/plus.png"), "") boton_agregar_empresa.clicked.connect(self.agregar_empresa) boton_agregar_empresa.setMinimumSize(50, 10) boton_eliminar_empresa = QPushButton(QIcon("iconos/minus.png"), "") boton_eliminar_empresa.clicked.connect(self.eliminar_empresa) boton_eliminar_empresa.setMinimumSize(50, 10) boton_editar_empresa = QPushButton(QIcon("iconos/edit.png"), "") boton_editar_empresa.clicked.connect(self.editar_empresa) boton_editar_empresa.setMinimumSize(50, 10) caja_botones = QVBoxLayout() caja_botones.addStretch(1) caja_botones.addWidget(boton_agregar_empresa) caja_botones.addWidget(boton_eliminar_empresa) caja_botones.addWidget(boton_editar_empresa) caja_botones.addStretch(5) caja_totales = QHBoxLayout() caja_totales.addWidget(self.cantidad_empresas) caja_totales.addWidget(self.espacio) caja_totales.addWidget(self.total_facturacion_media_anual) caja_totales.addWidget(self.total_recursos_financieros) caja_totales.addWidget(self.total_experiencia) grilla = QGridLayout() grilla.setColumnMinimumWidth(1, 20) grilla.addWidget(QLabel("Id"), 0, 0) grilla.addWidget(self.id_error, 0, 1, Qt.AlignTop | Qt.AlignRight) grilla.addWidget(self.id, 0, 2) grilla.addWidget(QLabel("Nombre"), 1, 0) grilla.addWidget(self.nombre_error, 1, 1, Qt.AlignTop | Qt.AlignRight) grilla.addWidget(self.nombre, 1, 2) grilla.addWidget(QLabel("Socios"), 2, 0, Qt.AlignTop) grilla.addWidget(self.empresas_error, 2, 1, Qt.AlignTop | Qt.AlignRight) grilla.addWidget(self.empresas, 2, 2) grilla.addLayout(caja_botones, 2, 3) grilla.addWidget(self.espaciador, 3, 1) grilla.addLayout(caja_totales, 3, 2) marco = QGroupBox("Asociación") marco.setLayout(grilla) caja_horizontal = QHBoxLayout() caja_horizontal.addStretch(1) caja_horizontal.addWidget(boton_cancelar) caja_horizontal.addStretch(5) caja_horizontal.addWidget(boton_confirmar) caja_horizontal.addStretch(1) caja_horizontal.setContentsMargins(10, 10, 10, 0) formulario = QFormLayout(self) formulario.addRow(marco) formulario.addRow(caja_horizontal) self.resize(self.sizeHint()) self.setMinimumSize(self.sizeHint()) self.setMaximumSize(self.sizeHint())
def initUI(self): # ================== WIDGET QTableWidget ================== self.tabla = QTableWidget(self) # Deshabilitar edición self.tabla.setEditTriggers(QAbstractItemView.NoEditTriggers) # Deshabilitar el comportamiento de arrastrar y soltar self.tabla.setDragDropOverwriteMode(False) # Seleccionar toda la fila self.tabla.setSelectionBehavior(QAbstractItemView.SelectRows) # Seleccionar una fila a la vez self.tabla.setSelectionMode(QAbstractItemView.SingleSelection) # Especifica dónde deben aparecer los puntos suspensivos "..." cuando se muestran # textos que no encajan self.tabla.setTextElideMode(Qt.ElideRight) # Qt.ElideNone # Establecer el ajuste de palabras del texto self.tabla.setWordWrap(False) # Deshabilitar clasificación # Establecer el número de columnas self.tabla.setColumnCount(2) # Establecer el número de filas self.tabla.setRowCount(0) # Alineación del texto del encabezado self.tabla.horizontalHeader().setDefaultAlignment(Qt.AlignHCenter | Qt.AlignVCenter | Qt.AlignCenter) # Deshabilitar resaltado del texto del encabezado al seleccionar una fila self.tabla.horizontalHeader().setHighlightSections(False) # Hacer que la última sección visible del encabezado ocupa todo el espacio disponible self.tabla.horizontalHeader().setStretchLastSection(True) # Ocultar encabezado vertical self.tabla.verticalHeader().setVisible(False) # Dibujar el fondo usando colores alternados self.tabla.setAlternatingRowColors(True) # Establecer altura de las filas self.tabla.verticalHeader().setDefaultSectionSize(20) # self.tabla.verticalHeader().setHighlightSections(True) nombreColumnas = ("Planta", "Tarea") # Establecer las etiquetas de encabezado horizontal usando etiquetas self.tabla.setHorizontalHeaderLabels(nombreColumnas) # Menú contextual self.tabla.setContextMenuPolicy(Qt.CustomContextMenu) self.tabla.customContextMenuRequested.connect(self.menuContextual) # Establecer ancho de las columnas for indice, ancho in enumerate((80, 120, 120, 110, 150), start=0): self.tabla.setColumnWidth(indice, ancho) self.tabla.resize(700, 240) self.tabla.move(20, 56) # =================== WIDGETS QPUSHBUTTON ================== botonMostrarDatos = QPushButton("Mostrar datos", self) botonMostrarDatos.setFixedWidth(140) botonMostrarDatos.move(20, 20) menu = QMenu() for indice, columna in enumerate(nombreColumnas, start=0): accion = QAction(columna, menu) accion.setCheckable(True) accion.setChecked(True) accion.setData(indice) menu.addAction(accion) botonMostrarOcultar = QPushButton("Motrar/ocultar columnas", self) botonMostrarOcultar.setFixedWidth(180) botonMostrarOcultar.setMenu(menu) botonMostrarOcultar.move(170, 20) botonCerrar = QPushButton("Cerrar", self) botonCerrar.setFixedWidth(80) botonCerrar.move(640, 306) # ======================== EVENTOS ========================= botonMostrarDatos.clicked.connect(self.datosTabla) botonCerrar.clicked.connect(self.close) menu.triggered.connect(self.mostrarOcultar)
def setup(self): vLayout = QVBoxLayout() hLayout1 = QHBoxLayout() # self.toolBar =self.addToolBar('tools') #self.setStyleSheet("{background-color: black}") menubar = self.menuBar() menubar.setNativeMenuBar(False) self.fileMenu = menubar.addMenu('&File') self.PlotMenu = menubar.addMenu('&Plot') self.ZoomMenu = menubar.addMenu('&Zoom') self.Aboutenu = menubar.addMenu('&About') self.setContentsMargins(0, 0, 0, 0) self.openAct = QAction(QtGui.QIcon(self.icon + "Open.png"), 'Open File', self) self.openAct.setShortcut('Ctrl+o') self.openAct.triggered.connect(self.openF) self.fileMenu.addAction(self.openAct) self.saveAct = QAction(QtGui.QIcon(self.icon + "disketteSave.png"), 'Save file', self) self.saveAct.setShortcut('Ctrl+s') self.saveAct.triggered.connect(self.saveF) self.fileMenu.addAction(self.saveAct) self.PlotMenu.addAction('max', self.PlotMAX) self.PlotMenu.addAction('min', self.PlotMIN) self.PlotMenu.addAction('x max', self.PlotXMAX) self.PlotMenu.addAction('y max', self.PlotYMAX) self.PlotMenu.addAction('Sum', self.PlotSUM) self.PlotMenu.addAction('Mean', self.PlotMEAN) self.PlotMenu.addAction('x center mass', self.PlotXCMASS) self.PlotMenu.addAction('y center mass', self.PlotYCMASS) self.ZoomMenu.addAction('max', self.ZoomMAX) self.ZoomMenu.addAction('Sum', self.ZoomSUM) self.ZoomMenu.addAction('Mean', self.ZoomMEAN) self.ZoomMenu.addAction('X max', self.ZoomXmax) self.ZoomMenu.addAction('Y max', self.ZoomYmax) self.ZoomMenu.addAction(' X c.of.m', self.ZoomCxmax) self.ZoomMenu.addAction(' Y c.of.m', self.ZoomCymax) self.But_reset = QAction('Reset', self) self.PlotMenu.addAction(self.But_reset) hLayout2 = QHBoxLayout() self.table = QTableWidget() hLayout2.addWidget(self.table) self.table.setColumnCount(10) #self.table.setRowCount(10) self.table.setHorizontalHeaderLabels( ('File', 'Max', 'Min', 'x max', 'y max', 'Sum', 'Mean', 'Size', 'x c.mass', 'y c.mass')) if self.confMot != None: self.motorNameBox = QComboBox() self.motorNameBox.addItem('Motors') hLayout1.addWidget(self.motorNameBox) self.unitBouton = QComboBox() self.unitBouton.addItem('Step') self.unitBouton.addItem('um') self.unitBouton.addItem('mm') self.unitBouton.addItem('ps') self.unitBouton.addItem('°') self.unitBouton.setMaximumWidth(100) self.unitBouton.setMinimumWidth(100) hLayout1.addWidget(self.unitBouton) self.unitBouton.currentIndexChanged.connect(self.unit) for mo in range(0, self.nbMotors): self.motorNameBox.addItem(self.groups[mo]) self.table.setColumnCount(11) self.table.setHorizontalHeaderLabels( ('File', 'Max', 'Min', 'x max', 'y max', 'Sum', 'Mean', 'Size', 'x c.mass', 'y c.mass', 'Motor')) self.motorNameBox.currentIndexChanged.connect(self.motorChange) self.motor = str(self.motorNameBox.currentText()) self.table.horizontalHeader().setVisible(True) self.table.setAlternatingRowColors(True) self.table.resizeColumnsToContents() self.table.setEditTriggers( QAbstractItemView.NoEditTriggers) # no modifiable vLayout.addLayout(hLayout1) vLayout.addLayout(hLayout2) MainWidget = QWidget() MainWidget.setLayout(vLayout) self.setCentralWidget(MainWidget) self.setContentsMargins(1, 1, 1, 1) if self.parent is not None: self.parent.newMesurment.connect(self.Display) self.But_reset.triggered.connect(self.Reset)
def createInboundPanel(self): super(InboundPanel, self).createTransportPanel() super(InboundPanel, self).createInboundSettingPanel() super(InboundPanel, self).createInboundPortocolPanel() vboxInboundPanel = QVBoxLayout() vboxInboundPanel.addLayout(self.vboxInboundSettingPanel) vboxInboundPanel.addLayout(self.vboxInboundProtocol) vboxInboundPanel.addLayout(self.vboxcheckBoxStreamSetting) vboxInboundPanel.addStretch() groupBoxInboundPanel = QGroupBox("", self) groupBoxInboundPanel.setLayout(vboxInboundPanel) self.tableWidgetInbound = tableWidgetInbound = QTableWidget() tableWidgetInbound.setColumnCount(3) tableWidgetInbound.setHorizontalHeaderLabels(self.labelHeaderInbound) tableWidgetInbound.setSelectionMode(QAbstractItemView.SingleSelection) tableWidgetInbound.setSelectionBehavior(QAbstractItemView.SelectRows) tableWidgetInbound.setEditTriggers(QAbstractItemView.NoEditTriggers) tableWidgetInbound.horizontalHeader().setStretchLastSection(True) splitterInbound = QSplitter(Qt.Horizontal) splitterInbound.addWidget(tableWidgetInbound) splitterInbound.addWidget(groupBoxInboundPanel) btnInboundApply = QPushButton(self.translate("InboundPanel", "Add"), self) btnInboundDelete = QPushButton( self.translate("InboundPanel", "Delete"), self) btnInboundChange = QPushButton(self.translate("InboundPanel", "Apply"), self) self.btnGroupInbound = btnGroupInbound = QButtonGroup() btnGroupInbound.addButton(btnInboundApply) btnGroupInbound.addButton(btnInboundChange) btnGroupInbound.addButton(btnInboundDelete) hboxBtnInbound = QHBoxLayout() hboxBtnInbound.addStretch() hboxBtnInbound.addWidget(btnInboundApply) hboxBtnInbound.addWidget(btnInboundChange) hboxBtnInbound.addWidget(btnInboundDelete) vboxSpliterInbound = QVBoxLayout() vboxSpliterInbound.addWidget(splitterInbound) vboxSpliterInbound.addLayout(hboxBtnInbound) groupBoxSpliterInbound = QGroupBox("", self) groupBoxSpliterInbound.setLayout(vboxSpliterInbound) self.createInboundPanelSignals() if (v2rayshellDebug): self.__debugBtn = QPushButton("__debugTest", self) self.__debugRefresh = QPushButton("__debugRefresh", self) hbox = QHBoxLayout(self) hbox.addWidget(self.__debugBtn) hbox.addWidget(self.__debugRefresh) groupBoxdebugBtn = QGroupBox("", self) groupBoxdebugBtn.setLayout(hbox) vboxSpliterInbound.addWidget(groupBoxdebugBtn) self.editV2rayJSONFile = openV2rayJSONFile.editV2rayJSONFile( CaptainstreasureChest=self.treasureChest) tabWidget = QTabWidget() tabWidget.addTab(groupBoxSpliterInbound, "Inbound") tabWidget.addTab(self.editV2rayJSONFile.createPanel(), "open V2ray File") self.__debugBtn.clicked.connect(self.__debugTest) self.__debugRefresh.clicked.connect( self.refreshInboundPaneltableWidget) self.settingInboundPanelFromJSONFile(self.inboundJSONFile, True) return tabWidget return groupBoxSpliterInbound
def _init_layout(self): """ Create the GUI widgets (but leave them empty). """ hostname_combobox = QComboBox(parent=self) self._hostname_combobox = hostname_combobox hostname_combobox.setEditable(True) hostname_combobox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) for hostname in self._suggested_hostnames: hostname_combobox.addItem(hostname) # EventFilter is installed after everything else is initialized. (See below.) #hostname_combobox.installEventFilter(self) self._connect_button = QPushButton("Connect", parent=self, clicked=self._handle_new_hostname) hostname_layout = QHBoxLayout() hostname_layout.addWidget(hostname_combobox) hostname_layout.addWidget(self._connect_button) hostinfo_table = QTableWidget() hostinfo_table.setColumnCount(len(SERVER_INFO_FIELDS)) hostinfo_table.setHorizontalHeaderLabels(SERVER_INFO_FIELDS) hostinfo_table.horizontalHeader().setVisible(True) hostinfo_table.verticalHeader().setVisible(False) hostinfo_table.setRowCount(1) hostinfo_table.setItem(0, 0, QTableWidgetItem("Placeholder")) hostinfo_table.setVisible(False) hostinfo_table.resizeRowsToContents() hostinfo_table.horizontalHeader().setStretchLastSection(True) table_height = hostinfo_table.verticalHeader().sectionSize( 0) + hostinfo_table.rowHeight(0) hostinfo_table.resize(QSize(hostinfo_table.width(), table_height)) hostinfo_table.setMaximumSize(QSize(1000, table_height)) hostinfo_table.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) host_layout = QVBoxLayout() host_layout.addLayout(hostname_layout) host_layout.addWidget(hostinfo_table) host_groupbox = QGroupBox("DVID Host", parent=self) host_groupbox.setLayout(host_layout) host_groupbox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) repo_treewidget = QTreeWidget(parent=self) repo_treewidget.setHeaderLabels( TREEVIEW_COLUMNS) # TODO: Add type, shape, axes, etc. repo_treewidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) repo_treewidget.itemSelectionChanged.connect( self._handle_data_selection) data_layout = QVBoxLayout() data_layout.addWidget(repo_treewidget) data_groupbox = QGroupBox("Data Volumes", parent=self) data_groupbox.setLayout(data_layout) node_listwidget = QListWidget(parent=self) node_listwidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) node_listwidget.itemSelectionChanged.connect(self._update_status) node_layout = QVBoxLayout() node_layout.addWidget(node_listwidget) node_groupbox = QGroupBox("Nodes", parent=self) node_groupbox.setLayout(node_layout) new_data_edit = QLineEdit(parent=self) new_data_edit.textEdited.connect(self._update_status) full_url_label = QLabel(parent=self) full_url_label.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) text_flags = full_url_label.textInteractionFlags() full_url_label.setTextInteractionFlags(text_flags | Qt.TextSelectableByMouse) new_data_layout = QVBoxLayout() new_data_layout.addWidget(new_data_edit) new_data_groupbox = QGroupBox("New Data Volume", parent=self) new_data_groupbox.setLayout(new_data_layout) new_data_groupbox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) buttonbox = QDialogButtonBox(Qt.Horizontal, parent=self) buttonbox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) buttonbox.button(QDialogButtonBox.Ok).setEnabled(False) layout = QVBoxLayout() layout.addWidget(host_groupbox) layout.addWidget(data_groupbox) layout.addWidget(node_groupbox) if self._mode == "specify_new": layout.addWidget(new_data_groupbox) else: new_data_groupbox.hide() layout.addWidget(full_url_label) layout.addWidget(buttonbox) # Stretch factors layout.setStretchFactor(data_groupbox, 3) layout.setStretchFactor(node_groupbox, 1) self.setLayout(layout) self.setWindowTitle("Select DVID Volume") self.resize(1000, 1000) # Initially disabled data_groupbox.setEnabled(False) node_groupbox.setEnabled(False) new_data_groupbox.setEnabled(False) # Set tab order self.setTabOrder(hostname_combobox, repo_treewidget) self.setTabOrder(repo_treewidget, node_listwidget) self.setTabOrder(node_listwidget, buttonbox) # Save instance members self._hostinfo_table = hostinfo_table self._data_groupbox = data_groupbox self._node_groupbox = node_groupbox self._new_data_groupbox = new_data_groupbox self._repo_treewidget = repo_treewidget self._node_listwidget = node_listwidget self._new_data_edit = new_data_edit self._full_url_label = full_url_label self._buttonbox = buttonbox # Finally install eventfilter (after everything is initialized) hostname_combobox.installEventFilter(self)
def __init__(self, info, parent=None): super(AnalysisInfoDialog, self).__init__(parent) self.setWindowTitle('Analysis Additional Info') self.resize(400, 400) self.gridLayout = QGridLayout(self) self.table = QTableWidget() self.table.setRowCount(len(list(info.keys()))) self.table.setColumnCount(1) boldFont = QFont() boldFont.setWeight(75) boldFont.setBold(True) totalHeight = 20 totalWidth = 50 row = 0 for key in list(info.keys()): if key in ('xprior', 'xtable', 'ytable', 'obsTable'): continue #item = QTableWidgetItem(key) #self.table.setItem(row, 0, item) if isinstance(info[key], (list, tuple)): strings = [] for strItem in info[key]: if isinstance(strItem, dict): ks = list(strItem.keys()) for k in ks: if strItem[k] is None: del strItem[k] strings.append(str(strItem)) item = QTableWidgetItem('\n'.join(strings)) else: item = QTableWidgetItem(str(info[key])) self.table.setItem(row, 0, item) row += 1 if row > 0: label = QLabel('Additional Info') label.setFont(boldFont) self.gridLayout.addWidget(label) self.gridLayout.addWidget(self.table) self.table.horizontalHeader().setHidden(True) self.table.setRowCount(row) self.table.setVerticalHeaderLabels([key for key in list(info.keys()) if key not in ('xprior', 'xtable', 'ytable', 'obsTable')]) #self.table.verticalHeader().setHidden(True) self.table.setWordWrap(True) self.table.resizeColumnsToContents() self.table.resizeRowsToContents() self.show() # Needed for headers to be correctly sized width = 2 + self.table.verticalHeader().width() + self.table.columnWidth(0) if self.table.verticalScrollBar().isVisible(): width += self.table.verticalScrollBar().width() self.table.setMinimumWidth(width) maxHeight = 3 for i in range(row): maxHeight += self.table.rowHeight(i) self.table.setMinimumHeight(maxHeight) totalHeight += maxHeight + 20 if width + 20 > totalWidth: totalWidth = width + 20 # Show table for key in info: if key in ('xprior', 'xtable', 'ytable', 'obsTable'): #self.resize(800, 400) values = info[key] for d in values: if d is not None and 'type' in d and d['type'] == 'Design': keys = list(d.keys()) for k in keys: if k not in ('name', 'type'): del d[k] if key == 'ytable': labelString = 'Outputs' elif key == 'obsTable': labelString = 'Experiments' else: labelString = 'Inputs' label = QLabel(labelString) label.setFont(boldFont) self.gridLayout.addWidget(label) table = QTableWidget() self.gridLayout.addWidget(table) table.setRowCount(len([1 for i in range(len(values)) if values[i] is not None])) # column headers if key == 'obsTable': inputInfo = info['xtable'] designVars = [] for d in inputInfo: if 'type' in d and d['type'] == 'Design': designVars.append(d['name']) columnHeaders = [name + ' Value' for name in designVars] outputInfo = info['ytable'] outputVars = [d['name'] for d in outputInfo if d is not None] for out in outputVars: columnHeaders.append(out + ' Mean') columnHeaders.append(out + ' Std Dev') table.setColumnCount(len(columnHeaders)) table.setHorizontalHeaderLabels(columnHeaders) table.setVerticalHeaderLabels(['Experiment ' + str(num) for num in range(1, len(values) + 1)]) else: columnSet = set() if key == 'ytable': valuesKeys = ['name', 'rsIndex', 'legendreOrder', 'marsBases', 'marsInteractions', 'userRegressionFile'] columnHeaders = ['Output Name', 'RS Type', 'Legendre Order', 'MARS # Basis Functions', 'MARS Deg. of Interaction', 'User Regression File'] else: #xprior, xtable valuesKeys = ['name', 'type', 'value', 'pdf', 'param1', 'param2', 'min', 'max'] columnHeaders = ['Input Name', 'Type', 'Fixed Value', 'PDF', 'PDF Param 1', 'PDF Param 2', 'Min', 'Max'] for d in values: if d is not None: d2 = copy.deepcopy(d) for key in d2: if d2[key] is None: del d[key] columnSet = columnSet.union(set(d.keys())) table.setColumnCount(len(columnSet)) usedColumns = [] usedHeaders = [] columnIndices = {} for i, (valuesKey, header) in enumerate(zip(valuesKeys, columnHeaders)): if valuesKey in columnSet: usedColumns.append(valuesKey) usedHeaders.append(header) columnIndices[valuesKey] = i table.setHorizontalHeaderLabels(usedHeaders) table.verticalHeader().setHidden(True) table.setWordWrap(True) r = 0 for i in range(len(values)): if key == 'obsTable': for c, string in enumerate(values[r][1:]): item = QTableWidgetItem(string) table.setItem(r, c, item) r += 1 elif values[r] is not None: for c, colName in enumerate(usedColumns): if colName in values[r]: if colName == 'pdf': string = Distribution.getFullName(values[r][colName]) elif colName == 'rsIndex': string = ResponseSurfaces.getFullName(values[r][colName]) else: string = str(values[r][colName]) item = QTableWidgetItem(string) table.setItem(r, c, item) r += 1 table.resizeColumnsToContents() QtCore.QCoreApplication.processEvents() width = 2 if key == 'obsTable': width += table.verticalHeader().width() for i in range(table.columnCount()): width += table.columnWidth(i) if table.verticalScrollBar().isVisible(): width += table.verticalScrollBar().width() if width > 800: width = 800 table.setMinimumWidth(width) maxHeight = 3 + table.horizontalHeader().height() for i in range(table.rowCount()): maxHeight += table.rowHeight(i) maxHeight = min([maxHeight, 400]) table.setMinimumHeight(maxHeight) totalHeight += maxHeight + 20 if width + 20 > totalWidth: totalWidth = width + 20 self.okButton = QPushButton(self) self.okButton.setText('OK') self.okButton.clicked.connect(self.close) self.gridLayout.addWidget(self.okButton) self.show() self.resize(totalWidth, totalHeight)
def __init__(self, index): QWidget.__init__(self) self.index = index self.ax1 = None self.show_key = True self.edit_list = [] self.line_number = [] self.list = [] self.fig = Figure(figsize=(5, 4), dpi=100) self.canvas = FigureCanvas(self.fig) self.canvas.figure.patch.set_facecolor('white') gui_pos = 0 print("index=", index) self.main_vbox = QVBoxLayout() self.main_vbox.addWidget(self.canvas) #toolbar 2 toolbar2 = QToolBar() toolbar2.setIconSize(QSize(32, 32)) self.tb_add = QAction(icon_get("list-add"), _("Add section"), self) self.tb_add.triggered.connect(self.callback_add_section) toolbar2.addAction(self.tb_add) self.tb_remove = QAction(icon_get("list-remove"), _("Delete section"), self) self.tb_remove.triggered.connect(self.callback_remove_item) toolbar2.addAction(self.tb_remove) self.tb_move = QAction(icon_get("go-down"), _("Move down"), self) self.tb_move.triggered.connect(self.callback_move_down) toolbar2.addAction(self.tb_move) self.tb_move_up = QAction(icon_get("go-up"), _("Move up"), self) self.tb_move_up.triggered.connect(self.callback_move_up) toolbar2.addAction(self.tb_move_up) self.main_vbox.addWidget(toolbar2) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.load_data() self.build_mesh() self.draw_graph() self.update_scan_tokens() self.tab.cellChanged.connect(self.on_cell_edited) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) return
def __init__(self, *args, **kwargs): super(HomepageAdAdminUI, self).__init__(*args, **kwargs) self.ad_table = QTableWidget(self) self.ad_table.verticalHeader().hide() self.ad_table.setFrameShape(QFrame.NoFrame) self.ad_table.setEditTriggers(QHeaderView.NoEditTriggers) self.ad_table.setColumnCount(9) self.ad_table.setHorizontalHeaderLabels( ["编号", "标题", "类型", "图片", "文件", "网址", "内容", "备注", "启用"]) self.ad_table.horizontalHeader().setSectionResizeMode( 0, QHeaderView.ResizeToContents) self.ad_table.horizontalHeader().setSectionResizeMode( 1, QHeaderView.ResizeToContents) self.addTab(self.ad_table, "广告管理") new_ad_widget = QWidget(self) create_layout = QGridLayout() create_layout.addWidget(QLabel("标题:", self), 0, 0) self.new_title = QLineEdit(self) self.new_title.setPlaceholderText("在此输入广告的标题") create_layout.addWidget(self.new_title, 0, 1) create_layout.addWidget(QLabel("类型:", self), 1, 0) self.ad_type = QComboBox(self) create_layout.addWidget(self.ad_type) self.file_label = QLabel("文件:", self) create_layout.addWidget(self.file_label, 2, 0) self.filepath_edit = FilePathLineEdit(self) self.filepath_edit.setPlaceholderText("点击选择pdf文件") create_layout.addWidget(self.filepath_edit, 2, 1) self.content_label = QLabel("内容:", self) create_layout.addWidget(self.content_label, 3, 0) self.content_edit = QLineEdit(self) self.content_edit.setPlaceholderText("在此输入要显示的内容") create_layout.addWidget(self.content_edit, 3, 1) self.web_label = QLabel("网址:", self) create_layout.addWidget(self.web_label, 4, 0) self.web_edit = QLineEdit(self) self.web_edit.setPlaceholderText("在此输入要跳转的网址") create_layout.addWidget(self.web_edit, 4, 1) create_layout.addWidget(QLabel("图片:", self), 5, 0) self.imagepath_edit = ImagePathLineEdit(self) self.imagepath_edit.setPlaceholderText("点击选择图片") create_layout.addWidget(self.imagepath_edit, 5, 1) self.tip_label = QLabel( "<div style=color:rgb(233,66,66)>创建完成默认运营可见,确认无误后到广告管理公开。</div>") create_layout.addWidget(self.tip_label, 6, 1) self.create_button = QPushButton("确定创建", self) create_layout.addWidget(self.create_button, 6, 1, alignment=Qt.AlignRight) new_ad_widget.setLayout(create_layout) self.addTab(new_ad_widget, "新建广告")
def __init__(self): super().__init__() # needed variable self.db_connection = None self.buttonCalledAction = None # Main body self.bodyQVBoxLayout = QVBoxLayout() self.body = QWidget() # ----------------- # Header self.headerQHBoxLayout = QHBoxLayout() self.header = QWidget() self.headerQHBoxLayout.setSpacing(20) self.headerQHBoxLayout.setContentsMargins(20, 11, 20, 11) # Add Book Button self.addBookQButton = QPushButton() self.addBookQButton.setIcon(QIcon('design/images/add.png')) self.addBookQButton.setIconSize(QSize(28, 28)) self.addBookQButton.setFocusPolicy(Qt.NoFocus) # Remove Book Button self.removeBookQButton = QPushButton() self.removeBookQButton.setIcon(QIcon('design/images/removeBook.png')) self.removeBookQButton.setIconSize(QSize(28, 28)) self.removeBookQButton.setFocusPolicy(Qt.NoFocus) # Search Bar self.searchBar = QLineEdit() self.searchBar.setClearButtonEnabled(True) self.searchBar.setFocusPolicy(Qt.ClickFocus) # Settings self.settingsQButton = QPushButton() self.settingsQButton.setIcon(QIcon('design/images/settings.png')) self.settingsQButton.setIconSize(QSize(32, 32)) self.settingsQButton.setFocusPolicy(Qt.NoFocus) # ----------------- # Container self.containerQHBoxLayout = QHBoxLayout() self.container = QWidget() self.containerQHBoxLayout.setContentsMargins(20, 20, 20, 40) self.containerQHBoxLayout.setSpacing(0) # Side Bar self.sideBar = QWidget() self.sideBarQVBoxLayout = QVBoxLayout() self.sideBarQVBoxLayout.setContentsMargins(0, 10, 0, 0) # Library Label self.libLabel = QLabel() self.libLabel.setAlignment(Qt.AlignCenter) # Context menu self.context_menu = QMenu() self.open_act = self.context_menu.addAction("") self.edit_act = self.context_menu.addAction("") self.delete_act = self.context_menu.addAction("") styles.Styles.set_context_menu_styles(self.context_menu) # Categories self.categoriesQWidget = QWidget() self.categoriesQVBoxLayout = QVBoxLayout() self.categoriesQVBoxLayout.setContentsMargins(0, 20, 0, 0) self.categoriesQVBoxLayout.setSpacing(0) # Categories buttons self.categories = [] self.allQButton = QPushButton() self.favouritesQButton = QPushButton() # Create Category Button self.createCategoryQButton = QPushButton() # Create Category Dialog self.categoryQDialog = QInputDialog() self.categoryQDialog.setInputMode(QInputDialog.TextInput) self.categoryQDialog.setWindowIcon(QIcon('design/images/icon.ico')) self.categoryQDialog.resize(600, 400) # Content self.content = QWidget() self.contentQVBoxLayout = QVBoxLayout() self.contentQVBoxLayout.setContentsMargins(0, 0, 0, 0) # Category title in Content self.categoryQLabel = QLabel() self.categoryQLabel.setAlignment(Qt.AlignCenter) # Table self.table = QTableWidget() self.table.setColumnCount(6) # ScrollBar in Table self.tableScrollBar = QScrollBar() self.table.setVerticalScrollBar(self.tableScrollBar) self.table.setFocusPolicy(Qt.NoFocus) self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) # Main run self.setup_working_folder() localize.set_main_menu_localization(self) styles.Styles.set_main_menu_styles(self) self.init_body() # Settings window self.sett_menu = None
def __init__(self, session, project, defaults): QMainWindow.__init__(self, session) self.setupUi(self) self.helper = HelpHandler(self) self.help_topic = "swmm/src/src/projectdefaultsdialog.htm" self.defaults = defaults self.session = session self.project = project self.label_changed = False self.property_sub_changed = False self.parameter_changed = False self.loaded = False self.refresh_column = None if self.session is not None: self.setWindowTitle(self.session.model + " Project Defaults") self.cmdOK.clicked.connect(self.cmdOK_Clicked) self.cmdCancel.clicked.connect(self.cmdCancel_Clicked) #disable Help button on form since no other forms have one self.cmdHelp.setVisible(False) #self.cmdHelp.clicked.connect(self.cmdHelp_Clicked) # self.tabDefaults.currentChanged(int).connect(self.tab_changed) # self.tblGeneric.cellChanged(int, int).connect(self.tblGeneric_changed) self.tabDefaults.currentChanged.connect(self.tab_changed) self.tblGeneric.cellChanged.connect(self.tblGeneric_changed) self.chk4all.setVisible(False) self.corner_label_tab1 = QLabel("Object", self.tblGeneric) self.corner_label_tab1.setAlignment(QtCore.Qt.AlignCenter) self.corner_label_tab1.setAttribute( QtCore.Qt.WA_TransparentForMouseEvents) self.tblGeneric.verticalHeader().geometriesChanged.connect( self.resizeCorner) self.tblGeneric.horizontalHeader().geometriesChanged.connect( self.resizeCorner) self.gridLayout_tab2 = QGridLayout(self.tabDefaults.widget(1)) self.gridLayout_tab2.setObjectName(_fromUtf8("gridLayout_tab2")) self.tbl_2 = QTableWidget(self.tabDefaults.widget(1)) self.tbl_2.setObjectName(_fromUtf8("tbl_2")) self.tbl_2.setColumnCount(1) self.tbl_2.setRowCount(1) self.tbl_2.horizontalHeader().setStretchLastSection(True) self.gridLayout_tab2.addWidget(self.tbl_2, 0, 0, 0, 0) # self.tbl_2.cellChanged(int, int).connect(self.tbl_2_changed) self.tbl_2.cellChanged.connect(self.tbl_2_changed) self.corner_label_tab2 = QLabel("Property", self.tbl_2) self.corner_label_tab2.setAlignment(QtCore.Qt.AlignCenter) self.corner_label_tab2.setAttribute( QtCore.Qt.WA_TransparentForMouseEvents) self.tblGeneric.verticalHeader().geometriesChanged.connect( self.resizeCorner) self.tblGeneric.horizontalHeader().geometriesChanged.connect( self.resizeCorner) self.gridLayout_tab3 = QGridLayout(self.tabDefaults.widget(2)) self.gridLayout_tab3.setObjectName(_fromUtf8("gridLayout_tab3")) self.tbl_3 = QTableWidget(self.tabDefaults.widget(2)) self.tbl_3.setObjectName(_fromUtf8("tbl_3")) self.tbl_3.setColumnCount(1) self.tbl_3.setRowCount(1) self.tbl_3.horizontalHeader().setStretchLastSection(True) self.gridLayout_tab3.addWidget(self.tbl_3, 0, 0, 0, 0) self.tbl_3.cellChanged.connect(self.tbl_3_changed) self.corner_label_tab3 = QLabel("Option", self.tbl_3) self.corner_label_tab3.setAlignment(QtCore.Qt.AlignCenter) self.corner_label_tab3.setAttribute( QtCore.Qt.WA_TransparentForMouseEvents) self.tbl_3.verticalHeader().geometriesChanged.connect( self.resizeCorner) self.tbl_3.horizontalHeader().geometriesChanged.connect( self.resizeCorner) self.sm_hydraulics = QtCore.QSignalMapper(self) self.sm_hydraulics.mapped.connect(self.tbl_3_combo_indexChanged) self.populate_defaults() self.installEventFilter(self) self.loaded = True
def __init__(self, parent): super().__init__() # Init definations self.sheets = set() self.rules = [] self.combos_sheet = {} self.input_files_path = "" self.input_file = "" self.parent = parent self.layout = QHBoxLayout() self.left_layout = QVBoxLayout() self.right_layout = QVBoxLayout() self.layout.addLayout(self.left_layout) self.layout.addLayout(self.right_layout) #Left Layout self.layout_rules_buttons = QHBoxLayout() self.left_layout.addLayout(self.layout_rules_buttons) button_add_new_rule = QPushButton("Add New Rule") button_add_new_rule.clicked.connect(self.action_add_new_rule) button_delete_rule = QPushButton("Delete Selected Rule") button_delete_rule.clicked.connect(self.action_delete_rule) self.layout_rules_buttons.addWidget(button_add_new_rule) self.layout_rules_buttons.addWidget(button_delete_rule) labels_table_rules = QLabel("Writing Rules:") self.table_rules = QTableWidget() self.table_rules.setColumnCount(3) self.table_rules.setHorizontalHeaderLabels( ["Column Name", "Sheet Name", "Cell"]) header = self.table_rules.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.Stretch) header.setSectionResizeMode(1, QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QHeaderView.ResizeToContents) self.left_layout.addWidget(labels_table_rules) self.left_layout.addWidget(self.table_rules) #Right Layout button_save_reading_rules = QPushButton("Save Writing Rules") button_save_reading_rules.clicked.connect(self.action_save_rules) self.right_layout.addWidget(button_save_reading_rules) button_load_reading_rules = QPushButton("Load Writing Rules") button_load_reading_rules.clicked.connect(self.action_load_rules) self.right_layout.addWidget(button_load_reading_rules) label_sheets = QLabel("Sheets:") self.table_sheets = QTableWidget() self.table_sheets.setColumnCount(1) self.table_sheets.setHorizontalHeaderLabels(["Sheet Name"]) self.table_sheets.setEditTriggers(QTableWidget.NoEditTriggers) header = self.table_sheets.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.Stretch) self.right_layout.addWidget(label_sheets) self.right_layout.addWidget(self.table_sheets) # Layout Edit Buttons self.layout_add_sheet = QHBoxLayout() self.right_layout.addLayout(self.layout_add_sheet) self.lineedit_new_sheet_name = QLineEdit() button_add_new_sheet = QPushButton("Add Sheet") button_add_new_sheet.clicked.connect(self.action_add_sheet) button_delete_sheet = QPushButton("Delete Selected Sheet") button_delete_sheet.clicked.connect(self.action_delete_sheet) self.layout_add_sheet.addWidget(self.lineedit_new_sheet_name) self.layout_add_sheet.addWidget(button_add_new_sheet) self.layout_add_sheet.addWidget(button_delete_sheet) # / Layout Edit Buttons # Select Files Location self.layout_select_output_files_path = QHBoxLayout() self.right_layout.addWidget(QLabel("Output Files Path:")) self.right_layout.addLayout(self.layout_select_output_files_path) self.lineedit_output_files_path = QLineEdit() self.lineedit_output_files_path.setReadOnly(True) self.button_select_output_files_path = QPushButton("...") self.layout_select_output_files_path.addWidget( self.lineedit_output_files_path) self.layout_select_output_files_path.addWidget( self.button_select_output_files_path) self.button_select_output_files_path.clicked.connect( self.action_select_output_files_path) # Select Input File self.layout_select_input_file = QHBoxLayout() self.right_layout.addWidget( QLabel("Input (data) File (*.xlsx, *.csv):")) self.right_layout.addLayout(self.layout_select_input_file) self.lineedit_input_file = QLineEdit() self.lineedit_input_file.setReadOnly(True) self.button_select_input_file = QPushButton("...") self.layout_select_input_file.addWidget(self.lineedit_input_file) self.layout_select_input_file.addWidget(self.button_select_input_file) self.button_select_input_file.clicked.connect( self.action_select_input_file) # Select Theme File self.layout_select_template_file = QHBoxLayout() self.right_layout.addWidget(QLabel("Template File (*.xlsx):")) self.right_layout.addLayout(self.layout_select_template_file) self.lineedit_template_file = QLineEdit() self.lineedit_template_file.setReadOnly(True) self.button_select_template_file = QPushButton("...") self.layout_select_template_file.addWidget(self.lineedit_template_file) self.layout_select_template_file.addWidget( self.button_select_template_file) self.button_select_template_file.clicked.connect( self.action_select_template_file) self.button_run_rules = QPushButton("Run Rules") self.button_run_rules.clicked.connect(self.run_rules) self.right_layout.addWidget(self.button_run_rules) self.button_stop = QPushButton("Stop Writing") self.button_stop.setVisible(False) self.button_stop.clicked.connect(self.stop_thread) self.right_layout.addWidget(self.button_stop) self.right_layout.addStretch() self.setLayout(self.layout)
def __init__(self, main): """ Search movie web url by title. :param main: Reference for main windows. """ super(ViewMovieUrl, self).__init__() self.session = DB.get_session() self.main = main self.row_select = -1 text = texts.movie_s + ' ' + texts.search_web_url self.setWindowTitle(text) self.width = int(0.8 * main.frameSize().width()) self.height = int(0.8 * main.frameSize().height()) self.setGeometry(0, 0, self.width, self.height) self.subwindow = QWidget() p = self.palette() p.setColor(self.backgroundRole(), QColor(230, 230, 250)) self.setPalette(p) self.setWidget(self.subwindow) self.vbox_main = QVBoxLayout(self.subwindow) self.vbox_main.setContentsMargins(20, 20, 20, 20) # Title self.lb_title = QLabel(texts.title_s) self.lb_title.setMaximumSize(QSize(100, 25)) movie = db_select_all(self.session, Movie) self.cb_title = cb_create() populate_combobox(self.cb_title, movie) # Words text = texts.or_s + ' ' + texts.with_the_p + ' ' + texts.term_p self.lb_term = QLabel(text) self.le_term = le_create(30, texts.with_term_tt) self.le_term.setPlaceholderText('pressione enter') self.le_term.editingFinished.connect(self.query_term) # HBoxSearch self.hbox_search = hbox_create( [self.lb_title, self.cb_title, self.lb_term, self.le_term]) spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.hbox_search.addItem(spacer) self.vbox_main.addLayout(self.hbox_search) # total self.lb_total = QLabel(texts.lb_total) self.le_total = le_create(255) self.le_total.setMaximumWidth(100) # Buttons self.pb_clear = pb_create(texts.pb_clear, 11, 30) self.pb_clear.setMaximumWidth(100) self.pb_clear.setShortcut('Ctrl+L') self.pb_clear.clicked.connect(self.clear) self.pb_leave = pb_create(texts.pb_leave, 11, 30) self.pb_leave.setMaximumWidth(100) self.pb_leave.setShortcut('Ctrl+Q') self.pb_leave.clicked.connect(self.close) # Hbox_result self.hbox_result = hbox_create( [self.lb_total, self.le_total, self.pb_clear, self.pb_leave]) spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.hbox_result.addItem(spacer) self.vbox_main.addLayout(self.hbox_result) # Table self.table = QTableWidget() self.table.horizontalHeader().sectionClicked.connect( self.repaint_cells) self.rows = 0 self.clear_table() query = self.session.query(Movie).all() self.set_table(query) self.vbox_main.addWidget(self.table) self.cb_title.currentIndexChanged.connect(self.query_title)
def __init__(self): super().__init__() # Application specific parameters self.pixel2meter = 1.0 self.points_tmp = [] self.points_of_interest = [] self.original_x = 0.0 self.original_y = 0.0 self.circle_thickness = 4 self.diameter = 12 self.offset = 9 # Initialize the state: 0 - metric or original point not set self.status = 0 self.count_tmp = 0 # Painter parameters self.pen = QtGui.QPen() self.pen.setColor(QColor('#ffd035')) self.pen.setWidth(self.circle_thickness) self.brush = QtGui.QBrush(Qt.white, Qt.SolidPattern) # Text font self.label_font = QtGui.QFont() self.label_font.setFamily('Times') self.label_font.setBold(True) self.label_font.setPointSize(12) # Load the test image self.src_path = "../data/mapImg/lawnGmap.png" self.qt_img_raw = QPixmap(self.src_path) self.w_img = self.qt_img_raw.width() self.h_img = self.qt_img_raw.height() # Window layout self.setWindowTitle("Point coordinates select and locate") # The label that holds the image self.image_label = QLabel(self) self.image_label.setCursor(Qt.CrossCursor) # The text label holds the instruction below the image self.textLabel = QLabel( 'First set metric then click to select the interested points.') self.statusLabel = QLabel('Metric and origin not set.') # The table to contain the coordinates self.table = QTableWidget(self) self.table.setColumnCount(6) self.table.setHorizontalHeaderLabels( ['No.', 'pixel u', 'pixel v', 'spatial x', 'spatial y', 'note']) self.table.setColumnWidth(0, 7) self.table.setFixedWidth(self.get_table_width()) self.table.verticalHeader().setVisible(False) # Button to set metric. button_metric = QtWidgets.QPushButton(self) button_metric.clicked.connect(self.metric_update) button_metric.setText("Set metric") # Button to set origin. button_zero = QtWidgets.QPushButton(self) button_zero.clicked.connect(self.set_original) button_zero.setText("Set original point") # Button to select interested points. button_PoI = QtWidgets.QPushButton(self) button_PoI.clicked.connect(self.PoI_select) button_PoI.setText("Set interested points") # Button to clear drawn points from the image. button_points_clear = QtWidgets.QPushButton(self) button_points_clear.clicked.connect(self.points_clear) button_points_clear.setText("Clear drawn points.") # Add the palette section. palette = QtWidgets.QHBoxLayout() self.add_palette_buttons(palette) # A vertical box layout that contains image and instrutions. vbox1 = QVBoxLayout() # vbox1.addWidget(self.menubar) vbox1.addWidget(self.image_label) vbox1.addLayout(palette) vbox1.addWidget(self.statusLabel) # A vertical box layout that contains buttons. vbox2 = QVBoxLayout() vbox2.addWidget(self.table) vbox2.addWidget(button_metric) vbox2.addWidget(button_zero) vbox2.addWidget(button_PoI) vbox2.addWidget(button_points_clear) vbox2.addWidget(self.textLabel) # A overall horizonal box hbox = QHBoxLayout() hbox.addLayout(vbox1) hbox.addLayout(vbox2) self.setLayout(hbox) self.image_label.setPixmap(self.qt_img_raw) self.show()
def setupUi(self, MainWindow): resolution = QDesktopWidget().screenGeometry(self) print("resol : ", resolution) MainWindow.resize(resolution) #메인 화면 색상py self.setStyleSheet("color: black;" "background-color: white;") font = QFont() font.setFamily("NanumGothic") MainWindow.setFont(font) self.centralwidget = QWidget(MainWindow) self.label = QLabel(self.centralwidget) self.label.setGeometry(QRect(20, 20, 101, 31)) font = QFont() font.setFamily("NanumGothic") font.setPointSize(18) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.button_add = QPushButton(self.centralwidget) self.button_add.setGeometry(QRect(60, 730, 131, 34)) #버튼 스타일 변경 self.button_add.setStyleSheet(staticValues.blueButtonStyleSheet) self.button_add.setFont(staticValues.buttonFont) self.button_modi = QPushButton(self.centralwidget) self.button_modi.setGeometry(QRect(260, 730, 131, 34)) self.button_modi.setStyleSheet(staticValues.blueButtonStyleSheet) self.button_modi.setFont(staticValues.buttonFont) self.button_del = QPushButton(self.centralwidget) self.button_del.setGeometry(QRect(460, 730, 131, 34)) self.button_del.setStyleSheet(staticValues.redButtonStyleSheet) self.button_del.setFont(staticValues.buttonFont) self.button_upload = QPushButton(self.centralwidget) self.button_upload.setGeometry(QRect(790, 730, 131, 34)) self.button_upload.setStyleSheet(staticValues.grayButtonStyleSheet) self.button_upload.setFont(staticValues.buttonFont) self.tabWidget = QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QRect(40, 70, 1121, 621)) self.tab = QWidget() self.tab.layout = QVBoxLayout() self.tabWidget.addTab(self.tab, "회원 목록") self.tableWidget = QTableWidget(self.tab) self.tableWidget.setGeometry(QRect(0, 0, 1111, 591)) self.tableWidget.setObjectName("회원 목록") self.tableWidget.setColumnCount(13) self.tableWidget.setRowCount(0) self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableWidget.setHorizontalHeaderLabels([ "회원 ID", "단톡방", "코인명", "구매", "입금", "판매", "출근", "보유잔량", "총구매금액", "총판매금액", "수익", "평단가", "지갑주소" ]) # self.tableView = QTableWidget() # self.tableView.setColumnCount(5) # self.tableView.setRowCount(3) # self.tab.layout.addWidget(self.tableView) # self.tab.setLayout(self.tab.layout) # self.tab_2 = QWidget() # self.tabWidget.addTab(self.tab_2, "") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent=None, aw=None): super(flavorDlg, self).__init__(parent, aw) self.setModal(True) rcParams['path.effects'] = [] #avoid question mark context help flags = self.windowFlags() helpFlag = Qt.WindowContextHelpButtonHint flags = flags & (~helpFlag) self.setWindowFlags(flags) self.setWindowTitle( QApplication.translate("Form Caption", "Cup Profile", None)) settings = QSettings() if settings.contains("FlavorProperties"): self.restoreGeometry(settings.value("FlavorProperties")) defaultlabel = QLabel(QApplication.translate("Label", "Default", None)) self.defaultcombobox = QComboBox() self.defaultcombobox.addItems([ "", "Artisan", "SCCA", "CQI", "SweetMarias", "C", "E", "CoffeeGeek", "Intelligentsia", "IIAC", "WCRC", "*CUSTOM*" ]) self.defaultcombobox.setCurrentIndex(0) self.lastcomboboxIndex = 0 self.defaultcombobox.currentIndexChanged.connect(self.setdefault) self.flavortable = QTableWidget() self.flavortable.setTabKeyNavigation(True) self.createFlavorTable() leftButton = QPushButton("<") leftButton.setFocusPolicy(Qt.NoFocus) leftButton.clicked.connect(self.moveLeft) rightButton = QPushButton(">") rightButton.setFocusPolicy(Qt.NoFocus) rightButton.clicked.connect(self.moveRight) addButton = QPushButton(QApplication.translate("Button", "Add", None)) addButton.setFocusPolicy(Qt.NoFocus) addButton.clicked.connect(self.addlabel) delButton = QPushButton(QApplication.translate("Button", "Del", None)) delButton.setFocusPolicy(Qt.NoFocus) delButton.clicked.connect(self.poplabel) saveImgButton = QPushButton( QApplication.translate("Button", "Save Image", None)) saveImgButton.setFocusPolicy(Qt.NoFocus) #saveImgButton.clicked.connect(self.aw.resizeImg_0_1) # save as PNG (raster) saveImgButton.clicked.connect( self.aw.saveVectorGraph_PDF) # save as PDF (vector) # connect the ArtisanDialog standard OK/Cancel buttons self.dialogbuttons.accepted.connect(self.close) self.dialogbuttons.removeButton( self.dialogbuttons.button(QDialogButtonBox.Cancel)) self.backgroundCheck = QCheckBox( QApplication.translate("CheckBox", "Background", None)) if self.aw.qmc.flavorbackgroundflag: self.backgroundCheck.setChecked(True) self.backgroundCheck.clicked.connect(self.showbackground) aspectlabel = QLabel( QApplication.translate("Label", "Aspect Ratio", None)) self.aspectSpinBox = QDoubleSpinBox() self.aspectSpinBox.setToolTip( QApplication.translate("Tooltip", "Aspect Ratio", None)) self.aspectSpinBox.setRange(0., 2.) self.aspectSpinBox.setSingleStep(.1) self.aspectSpinBox.setValue(self.aw.qmc.flavoraspect) self.aspectSpinBox.valueChanged.connect(self.setaspect) flavorLayout = QHBoxLayout() flavorLayout.addWidget(self.flavortable) comboLayout = QHBoxLayout() comboLayout.addWidget(defaultlabel) comboLayout.addWidget(self.defaultcombobox) comboLayout.addStretch() aspectLayout = QHBoxLayout() aspectLayout.addWidget(self.backgroundCheck) aspectLayout.addWidget(aspectlabel) aspectLayout.addWidget(self.aspectSpinBox) aspectLayout.addStretch() blayout1 = QHBoxLayout() blayout1.addStretch() blayout1.addWidget(addButton) blayout1.addWidget(delButton) blayout1.addStretch() extralayout = QVBoxLayout() extralayout.addLayout(comboLayout) extralayout.addLayout(aspectLayout) extraGroupLayout = QGroupBox() extraGroupLayout.setLayout(extralayout) blayout = QHBoxLayout() blayout.addStretch() blayout.addWidget(leftButton) blayout.addWidget(rightButton) blayout.addStretch() mainButtonsLayout = QHBoxLayout() mainButtonsLayout.addWidget(saveImgButton) mainButtonsLayout.addStretch() mainButtonsLayout.addWidget(self.dialogbuttons) mainLayout = QVBoxLayout() mainLayout.addLayout(flavorLayout) mainLayout.addLayout(blayout1) mainLayout.addWidget(extraGroupLayout) mainLayout.addLayout(blayout) # mainLayout.addStretch() mainLayout.addLayout(mainButtonsLayout) self.setLayout(mainLayout) self.aw.qmc.flavorchart() self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus()