コード例 #1
1
	def init_right_panel(self):

		#def title_def(title):
		#	title_lbl = QLabel(title)
		#	f = QFont()
		#	f.setPixelSize(16)
		#	title_lbl.setFont(f)
		#	return title_lbl

		def groupbox(name, layout, parent, add_in_layout=None):
			"""
			Makes a groupbox and a layout for you
			Returns groupbox and layout
			"""
			g = QGroupBox(name, parent)
			l = layout(g)
			if add_in_layout:
				if isinstance(add_in_layout, QFormLayout):
					add_in_layout.addRow(g)
				else:
					add_in_layout.addWidget(g)
			return g, l

		def option_lbl_checkbox(text, optiontext, parent=None):
			l = QLabel(text)
			c = QCheckBox(text, parent)
			return l, c

		def new_tab(name, parent, scroll=False):
			"""
			Creates a new tab.
			Returns new tab page widget and it's layout
			"""
			new_t = QWidget(parent)
			new_l = QFormLayout(new_t)
			if scroll:
				scr = QScrollArea(parent)
				scr.setBackgroundRole(QPalette.Base)
				scr.setWidget(new_t)
				scr.setWidgetResizable(True)
				parent.addTab(scr, name)
				return new_t, new_l
			else:
				parent.addTab(new_t, name)
			return new_t, new_l


		# App
		application = QTabWidget(self)
		self.application_index = self.right_panel.addWidget(application)
		application_general, app_general_m_l = new_tab('General', application, True)

		# App / General / gallery
		app_gallery_page, app_gallery_l = new_tab('Gallery', application, True)
		self.subfolder_as_chapters = QCheckBox("Subdirectiories should be treated as standalone galleries instead of chapters (applies in archives too)")
		self.subfolder_as_chapters.setToolTip("This option will enable creating standalone galleries for each subdirectiories found recursively when importing."+
										"\nDefault action is treating each subfolder found as chapters of a gallery.")
		extract_gallery_info = QLabel("Note: This option has no effect when turned off if path to viewer is not specified.")
		self.extract_gallery_before_opening = QCheckBox("Extract archive before opening (only turn off if your viewer supports it)")
		self.open_galleries_sequentially = QCheckBox("Open chapters sequentially (Note: has no effect if path to viewer is not specified)")
		subf_info = QLabel("Behaviour of 'Scan for new galleries on startup' option will be affected.")
		subf_info.setWordWrap(True)
		app_gallery_l.addRow('Note:', subf_info)
		app_gallery_l.addRow(self.subfolder_as_chapters)
		app_gallery_l.addRow(extract_gallery_info)
		app_gallery_l.addRow(self.extract_gallery_before_opening)
		app_gallery_l.addRow(self.open_galleries_sequentially)
		self.scroll_to_new_gallery = QCheckBox("Scroll to newly added gallery")
		self.scroll_to_new_gallery.setDisabled(True)
		app_gallery_l.addRow(self.scroll_to_new_gallery)
		self.move_imported_gs, move_imported_gs_l = groupbox('Move imported galleries',
													   QFormLayout, app_gallery_page)
		self.move_imported_gs.setCheckable(True)
		self.move_imported_gs.setToolTip("Move imported galleries to specified folder.")
		self.move_imported_def_path = PathLineEdit()
		move_imported_gs_l.addRow('Directory:', self.move_imported_def_path)
		app_gallery_l.addRow(self.move_imported_gs)
		self.rename_g_source_group, rename_g_source_l = groupbox('Rename gallery source',
													  QFormLayout, app_gallery_page)
		self.rename_g_source_group.setCheckable(True)
		self.rename_g_source_group.setDisabled(True)
		app_gallery_l.addRow(self.rename_g_source_group)
		rename_g_source_l.addRow(QLabel("Check what to include when renaming gallery source. (Same order)"))
		rename_g_source_flow_l = FlowLayout()
		rename_g_source_l.addRow(rename_g_source_flow_l)
		self.rename_artist = QCheckBox("Artist")
		self.rename_title = QCheckBox("Title")
		self.rename_lang = QCheckBox("Language")
		self.rename_title.setChecked(True)
		self.rename_title.setDisabled(True)
		rename_g_source_flow_l.addWidget(self.rename_artist)
		rename_g_source_flow_l.addWidget(self.rename_title)
		rename_g_source_flow_l.addWidget(self.rename_lang)
		random_gallery_opener, random_g_opener_l = groupbox('Random Gallery Opener', QFormLayout, app_gallery_page)
		app_gallery_l.addRow(random_gallery_opener)
		self.open_random_g_chapters = QCheckBox("Open random gallery chapters")
		random_g_opener_l.addRow(self.open_random_g_chapters)

		# App / General / Search
		app_search, app_search_layout = groupbox('Search', QFormLayout, application_general)
		app_general_m_l.addRow(app_search)
		search_allow_regex_l = QHBoxLayout()
		self.search_allow_regex = QCheckBox()
		self.search_allow_regex.setChecked(app_constants.ALLOW_SEARCH_REGEX)
		self.search_allow_regex.adjustSize()
		self.search_allow_regex.setToolTip('A regex cheatsheet is located at About->Regex Cheatsheet')
		search_allow_regex_l.addWidget(self.search_allow_regex)
		search_allow_regex_l.addWidget(QLabel('A regex cheatsheet is located at About->Regex Cheatsheet'))
		search_allow_regex_l.addWidget(Spacer('h'))
		app_search_layout.addRow('Regex:', search_allow_regex_l)
		# App / General / Search / autocomplete
		self.search_autocomplete = QCheckBox('*')
		self.search_autocomplete.setChecked(app_constants.SEARCH_AUTOCOMPLETE)
		self.search_autocomplete.setToolTip('Turn autocomplete on/off')
		app_search_layout.addRow('Autocomplete', self.search_autocomplete)
		# App / General / Search / search behaviour
		self.search_every_keystroke = QRadioButton('Search on every keystroke *', app_search)
		app_search_layout.addRow(self.search_every_keystroke)
		self.search_on_enter = QRadioButton('Search on return-key *', app_search)
		app_search_layout.addRow(self.search_on_enter)

		# App / General / External Viewer
		app_external_viewer, app_external_viewer_l = groupbox('External Viewer', QFormLayout, application_general, app_general_m_l)
		app_external_viewer_l.addRow(QLabel("Most image viewers should work. Incase it doesn't," +
									   " hit me up on email/github/gitter-chat to add support."))
		self.external_viewer_path = PathLineEdit(app_external_viewer, False, '')
		self.external_viewer_path.setPlaceholderText('Right/Left-click to open folder explorer.'+
							  ' Leave empty to use default viewer')
		self.external_viewer_path.setToolTip('Right/Left-click to open folder explorer.'+
							  ' Leave empty to use default viewer')
		self.external_viewer_path.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
		app_external_viewer_l.addRow('Path:', self.external_viewer_path)

		# App / General / Rar Support
		app_rar_group, app_rar_layout = groupbox('RAR Support *', QFormLayout, self)
		app_general_m_l.addRow(app_rar_group)
		rar_info = QLabel('Specify the path to the unrar tool to enable rar support.\n'+
					'Windows: "unrar.exe" should be in the "bin" directory if you installed from the'+
					' self-extracting archive provided on github.\nOSX: You can install this via HomeBrew.'+
					' Path should be something like: "/usr/local/bin/unrar".\nLinux: Should already be'+
					' installed. You can just type "unrar". If it\'s not installed, use your package manager: pacman -S unrar')
		rar_info.setWordWrap(True)
		app_rar_layout.addRow(rar_info)
		self.path_to_unrar = PathLineEdit(self, False, filters='')
		app_rar_layout.addRow('UnRAR tool path:', self.path_to_unrar)

		# App / Monitor
		app_monitor_page = QScrollArea()
		app_monitor_page.setBackgroundRole(QPalette.Base)
		app_monitor_dummy = QWidget()
		app_monitor_page.setWidgetResizable(True)
		app_monitor_page.setWidget(app_monitor_dummy)
		application.addTab(app_monitor_page, 'Monitoring')
		app_monitor_m_l = QVBoxLayout(app_monitor_dummy)
		# App / Monitor / misc
		app_monitor_misc_group = QGroupBox('General *', self)
		app_monitor_m_l.addWidget(app_monitor_misc_group)
		app_monitor_misc_m_l = QFormLayout(app_monitor_misc_group)
		monitor_info = QLabel('Directory monitoring will monitor the specified directories for any'+
						' filesystem events. For example if you delete a gallery source in one of your'+
						' monitored directories the application will inform you and ask if'+
						' you want to delete the gallery from the application as well.')
		monitor_info.setWordWrap(True)
		app_monitor_misc_m_l.addRow(monitor_info)
		self.enable_monitor = QCheckBox('Enable directory monitoring')
		app_monitor_misc_m_l.addRow(self.enable_monitor)
		self.look_new_gallery_startup = QGroupBox('Scan for new galleries on startup', self)
		app_monitor_misc_m_l.addRow(self.look_new_gallery_startup)
		self.look_new_gallery_startup.setCheckable(True)
		look_new_gallery_startup_m_l = QVBoxLayout(self.look_new_gallery_startup)
		self.auto_add_new_galleries = QCheckBox('Automatically add found galleries')
		look_new_gallery_startup_m_l.addWidget(self.auto_add_new_galleries)

		# App / Monitor / folders
		app_monitor_group = QGroupBox('Directories *', self)
		app_monitor_m_l.addWidget(app_monitor_group, 1)
		app_monitor_folders_m_l = QVBoxLayout(app_monitor_group)
		app_monitor_folders_add = QPushButton('+')
		app_monitor_folders_add.clicked.connect(self.add_folder_monitor)
		app_monitor_folders_add.setMaximumWidth(20)
		app_monitor_folders_add.setMaximumHeight(20)
		app_monitor_folders_m_l.addWidget(app_monitor_folders_add, 0, Qt.AlignRight)
		self.folders_layout = QFormLayout()
		app_monitor_folders_m_l.addLayout(self.folders_layout)

		# App / Ignore
		app_ignore, app_ignore_m_l = new_tab('Ignore', application, True)
		app_ignore_group, app_ignore_list_l = groupbox('List', QVBoxLayout, app_monitor_dummy)
		app_ignore_m_l.addRow(app_ignore_group)
		add_buttons_l = QHBoxLayout()
		app_ignore_add_a = QPushButton('Add archive')
		app_ignore_add_a.clicked.connect(lambda: self.add_ignore_path(dir=False))
		app_ignore_add_f = QPushButton('Add directory')
		app_ignore_add_f.clicked.connect(self.add_ignore_path)
		add_buttons_l.addWidget(app_ignore_add_a, 0, Qt.AlignRight)
		add_buttons_l.addWidget(app_ignore_add_f, 1, Qt.AlignRight)
		app_ignore_list_l.addLayout(add_buttons_l)
		self.ignore_path_l = QFormLayout()
		app_ignore_list_l.addLayout(self.ignore_path_l)

		# Web
		web = QTabWidget(self)
		self.web_index = self.right_panel.addWidget(web)

		# Web / Downloader
		web_downloader, web_downloader_l = new_tab('Downloader', web)
		hen_download_group, hen_download_group_l = groupbox('g.e-hentai/exhentai',
													  QFormLayout, web_downloader)
		web_downloader_l.addRow(hen_download_group)
		self.archive_download = QRadioButton('Archive', hen_download_group)
		self.torrent_download = QRadioButton('Torrent', hen_download_group)
		download_type_l = QHBoxLayout()
		download_type_l.addWidget(self.archive_download)
		download_type_l.addWidget(self.torrent_download, 1)
		hen_download_group_l.addRow('Download Type:', download_type_l)
		self.download_directory = PathLineEdit(web_downloader)
		web_downloader_l.addRow('Destination:', self.download_directory)
		self.torrent_client = PathLineEdit(web_downloader, False, '')
		web_downloader_l.addRow(QLabel("Leave empty to use default torrent client."+
								 "\nIt is NOT recommended to import a file while it's still downloading."))
		web_downloader_l.addRow('Torrent client:', self.torrent_client)

		# Web / Metadata
		web_metadata_page = QScrollArea()
		web_metadata_page.setBackgroundRole(QPalette.Base)
		web_metadata_page.setWidgetResizable(True)
		web.addTab(web_metadata_page, 'Metadata')
		web_metadata_dummy = QWidget()
		web_metadata_page.setWidget(web_metadata_dummy)
		web_metadata_m_l = QFormLayout(web_metadata_dummy)
		self.default_ehen_url = QRadioButton('g.e-hentai.org', web_metadata_page)
		self.exhentai_ehen_url = QRadioButton('exhentai.org', web_metadata_page)
		ehen_url_l = QHBoxLayout()
		ehen_url_l.addWidget(self.default_ehen_url)
		ehen_url_l.addWidget(self.exhentai_ehen_url, 1)
		web_metadata_m_l.addRow('Default URL:', ehen_url_l)
		self.continue_a_metadata_fetcher = QCheckBox('Continue from where auto metadata fetcher left off')
		web_metadata_m_l.addRow(self.continue_a_metadata_fetcher)
		self.use_jpn_title = QCheckBox('Use japanese title')
		self.use_jpn_title.setToolTip('Choose the japenese title over the english one')
		web_metadata_m_l.addRow(self.use_jpn_title)
		time_offset_info = QLabel('We need to impose a delay between our requests to avoid getting banned.'+
							' I have made it so you cannot set the delay lower than the recommended (I don\'t'+
							' want you to get banned, anon!).\nSpecify the delay between requests in seconds.')
		time_offset_info.setWordWrap(True)
		self.web_time_offset = QSpinBox()
		self.web_time_offset.setMaximumWidth(40)
		self.web_time_offset.setMinimum(4)
		self.web_time_offset.setMaximum(99)
		web_metadata_m_l.addRow(time_offset_info)
		web_metadata_m_l.addRow('Requests delay in seconds', self.web_time_offset)
		replace_metadata_info = QLabel('When fetching for metadata the new metadata will be appended'+
								 ' to the gallery by default. This means that new data will only be added if'+
								 ' the field was empty. There is however a special case for namespace & tags.'+
								 ' We go through all the new namespace & tags to only add those that'+
								 ' do not already exists.\n\nEnabling this option makes it so that a gallery\'s old data'+
								 ' are deleted and replaced with the new data.')
		replace_metadata_info.setWordWrap(True)
		self.replace_metadata = QCheckBox('Replace old metadata with new metadata')
		web_metadata_m_l.addRow(replace_metadata_info)
		web_metadata_m_l.addRow(self.replace_metadata)
		first_hit_info = QLabel('By default, you get to choose which gallery to extract metadata from when'+
						  ' there is more than one gallery found when searching.\n'+
						  'Enabling this option makes it choose the first hit, saving you from moving your mouse.')
		first_hit_info.setWordWrap(True)
		self.always_first_hit = QCheckBox('Always choose first hit')
		web_metadata_m_l.addRow(first_hit_info)
		web_metadata_m_l.addRow(self.always_first_hit)
		self.use_gallery_link = QCheckBox('Use current gallery link')
		self.use_gallery_link.setToolTip("Metadata will be fetched from the current gallery link"+
								   " if it's a valid ex/g.e gallery url")
		web_metadata_m_l.addRow(self.use_gallery_link)

		# Web / Exhentai
		exhentai_page = QWidget(self)
		web.addTab(exhentai_page, 'ExHentai')
		ipb_layout = QFormLayout()
		exhentai_page.setLayout(ipb_layout)
		self.ipbid_edit = QLineEdit()
		self.ipbpass_edit = QLineEdit()
		exh_tutorial = QLabel(app_constants.EXHEN_COOKIE_TUTORIAL)
		exh_tutorial.setTextFormat(Qt.RichText)
		ipb_layout.addRow('IPB Member ID:', self.ipbid_edit)
		ipb_layout.addRow('IPB Pass Hash:', self.ipbpass_edit)
		ipb_layout.addRow(exh_tutorial)

		# Visual
		visual = QTabWidget(self)
		self.visual_index = self.right_panel.addWidget(visual)
		visual_general_page = QWidget()
		visual.addTab(visual_general_page, 'General')

		grid_view_general_page = QWidget()
		visual.addTab(grid_view_general_page, 'Grid View')
		grid_view_layout = QVBoxLayout()
		grid_view_layout.addWidget(QLabel('Options marked with * requires application restart'),
						   0, Qt.AlignTop)
		grid_view_general_page.setLayout(grid_view_layout)
		# grid view
		# grid view / tooltip
		self.grid_tooltip_group = QGroupBox('Tooltip', grid_view_general_page)
		self.grid_tooltip_group.setCheckable(True)
		grid_view_layout.addWidget(self.grid_tooltip_group, 0, Qt.AlignTop)
		grid_tooltip_layout = QFormLayout()
		self.grid_tooltip_group.setLayout(grid_tooltip_layout)
		grid_tooltip_layout.addRow(QLabel('Control what is'+
									' displayed in the tooltip when hovering a gallery'))
		grid_tooltips_hlayout = FlowLayout()
		grid_tooltip_layout.addRow(grid_tooltips_hlayout)
		self.visual_grid_tooltip_title = QCheckBox('Title')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_title)
		self.visual_grid_tooltip_author = QCheckBox('Author')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_author)
		self.visual_grid_tooltip_chapters = QCheckBox('Chapters')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_chapters)
		self.visual_grid_tooltip_status = QCheckBox('Status')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_status)
		self.visual_grid_tooltip_type = QCheckBox('Type')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_type)
		self.visual_grid_tooltip_lang = QCheckBox('Language')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_lang)
		self.visual_grid_tooltip_descr = QCheckBox('Description')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_descr)
		self.visual_grid_tooltip_tags = QCheckBox('Tags')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_tags)
		self.visual_grid_tooltip_last_read = QCheckBox('Last read')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_last_read)
		self.visual_grid_tooltip_times_read = QCheckBox('Times read')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_times_read)
		self.visual_grid_tooltip_pub_date = QCheckBox('Publication Date')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_pub_date)
		self.visual_grid_tooltip_date_added = QCheckBox('Date added')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_date_added)
		# grid view / gallery
		grid_gallery_group = QGroupBox('Gallery', grid_view_general_page)
		grid_view_layout.addWidget(grid_gallery_group, 0, Qt.AlignTop)
		grid_gallery_main_l = QFormLayout()
		grid_gallery_main_l.setFormAlignment(Qt.AlignLeft)
		grid_gallery_group.setLayout(grid_gallery_main_l)
		grid_gallery_display = FlowLayout()
		grid_gallery_main_l.addRow('Display icon on gallery:', grid_gallery_display)
		self.external_viewer_ico = QCheckBox('External Viewer')
		grid_gallery_display.addWidget(self.external_viewer_ico)
		self.gallery_type_ico = QCheckBox('File Type')
		grid_gallery_display.addWidget(self.gallery_type_ico)
		if sys.platform.startswith('darwin'):
			grid_gallery_group.setEnabled(False)
		gallery_text_mode = QWidget()
		grid_gallery_main_l.addRow('Text Mode:', gallery_text_mode)
		gallery_text_mode_l = QHBoxLayout()
		gallery_text_mode.setLayout(gallery_text_mode_l)
		self.gallery_text_elide = QRadioButton('Elide text', gallery_text_mode)
		self.gallery_text_fit = QRadioButton('Fit text', gallery_text_mode)
		gallery_text_mode_l.addWidget(self.gallery_text_elide, 0, Qt.AlignLeft)
		gallery_text_mode_l.addWidget(self.gallery_text_fit, 0, Qt.AlignLeft)
		gallery_text_mode_l.addWidget(Spacer('h'), 1, Qt.AlignLeft)
		gallery_font = QHBoxLayout()
		grid_gallery_main_l.addRow('Font:*', gallery_font)
		self.font_lbl = QLabel()
		self.font_size_lbl = QSpinBox()
		self.font_size_lbl.setMaximum(100)
		self.font_size_lbl.setMinimum(1)
		self.font_size_lbl.setToolTip('Font size in pixels')
		choose_font = QPushButton('Choose font')
		choose_font.clicked.connect(self.choose_font)
		gallery_font.addWidget(self.font_lbl, 0, Qt.AlignLeft)
		gallery_font.addWidget(self.font_size_lbl, 0, Qt.AlignLeft)
		gallery_font.addWidget(choose_font, 0, Qt.AlignLeft)
		gallery_font.addWidget(Spacer('h'), 1, Qt.AlignLeft)
		# grid view / colors
		grid_colors_group = QGroupBox('Colors', grid_view_general_page)
		grid_view_layout.addWidget(grid_colors_group, 1, Qt.AlignTop)
		grid_colors_l = QFormLayout()
		grid_colors_group.setLayout(grid_colors_l)
		def color_lineedit():
			l = QLineEdit()
			l.setPlaceholderText('Hex colors. Eg.: #323232')
			l.setMaximumWidth(200)
			return l
		self.grid_label_color = color_lineedit()
		self.grid_title_color = color_lineedit()
		self.grid_artist_color = color_lineedit()
		grid_colors_l.addRow('Label color:', self.grid_label_color)
		grid_colors_l.addRow('Title color:', self.grid_title_color)
		grid_colors_l.addRow('Artist color:', self.grid_artist_color)

		style_page = QWidget(self)
		visual.addTab(style_page, 'Style')
		visual.setTabEnabled(0, False)
		visual.setTabEnabled(2, False)
		visual.setCurrentIndex(1)

		# Advanced
		advanced = QTabWidget(self)
		self.advanced_index = self.right_panel.addWidget(advanced)
		advanced_misc_scroll = QScrollArea(self)
		advanced_misc_scroll.setBackgroundRole(QPalette.Base)
		advanced_misc_scroll.setWidgetResizable(True)
		advanced_misc = QWidget()
		advanced_misc_scroll.setWidget(advanced_misc)
		advanced.addTab(advanced_misc_scroll, 'Misc')
		advanced_misc_main_layout = QVBoxLayout()
		advanced_misc.setLayout(advanced_misc_main_layout)
		misc_controls_layout = QFormLayout()
		advanced_misc_main_layout.addLayout(misc_controls_layout)
		# Advanced / Misc / Grid View
		misc_gridview = QGroupBox('Grid View')
		misc_controls_layout.addWidget(misc_gridview)
		misc_gridview_layout = QFormLayout()
		misc_gridview.setLayout(misc_gridview_layout)
		# Advanced / Misc / Grid View / scroll speed
		scroll_speed_spin_box = QSpinBox()
		scroll_speed_spin_box.setFixedWidth(60)
		scroll_speed_spin_box.setToolTip('Control the speed when scrolling in'+
								   ' grid view. DEFAULT: 7')
		scroll_speed_spin_box.setValue(self.scroll_speed)
		def scroll_speed(v): self.scroll_speed = v
		scroll_speed_spin_box.valueChanged[int].connect(scroll_speed)
		misc_gridview_layout.addRow('Scroll speed:', scroll_speed_spin_box)
		# Advanced / Misc / Grid View / cache size
		cache_size_spin_box = QSpinBox()
		cache_size_spin_box.setFixedWidth(120)
		cache_size_spin_box.setMaximum(999999999)
		cache_size_spin_box.setToolTip('This can greatly reduce lags/freezes in the grid view.' +
								 ' Increase the value if you experience lag when scrolling'+
								 ' through galleries. DEFAULT: 200 MiB')
		def cache_size(c): self.cache_size = (self.cache_size[0], c)
		cache_size_spin_box.setValue(self.cache_size[1])
		cache_size_spin_box.valueChanged[int].connect(cache_size)
		misc_gridview_layout.addRow('Cache Size (MiB):', cache_size_spin_box)

		# Advanced / Gallery
		advanced_gallery, advanced_gallery_m_l = new_tab('Gallery', advanced)
		def rebuild_thumbs():
			confirm_msg = QMessageBox(QMessageBox.Question, '', 'Are you sure you want to regenerate your thumbnails.',
							 QMessageBox.Yes | QMessageBox.No, self)
			if confirm_msg.exec() == QMessageBox.Yes:
				clear_cache_confirm = QMessageBox(QMessageBox.Question, '',
									  'Do you want to delete all old thumbnails before regenerating?', QMessageBox.Yes | QMessageBox.No,
									  self)
				clear_cache = False
				if clear_cache_confirm.exec() == QMessageBox.Yes:
					clear_cache = True
				gallerydb.DatabaseEmitter.RUN = False
				def start_db_activity(): gallerydb.DatabaseEmitter.RUN = True
				app_popup = ApplicationPopup(self.parent_widget)
				app_popup.info_lbl.setText("Regenerating thumbnails...")
				app_popup.admin_db = gallerydb.AdminDB()
				app_popup.admin_db.moveToThread(app_constants.GENERAL_THREAD)
				app_popup.admin_db.DONE.connect(app_popup.admin_db.deleteLater)
				app_popup.admin_db.DONE.connect(start_db_activity)
				app_popup.admin_db.DATA_COUNT.connect(app_popup.prog.setMaximum)
				app_popup.admin_db.PROGRESS.connect(app_popup.prog.setValue)
				self.init_gallery_rebuild.connect(app_popup.admin_db.rebuild_thumbs)
				app_popup.adjustSize()
				self.init_gallery_rebuild.emit(clear_cache)
				app_popup.show()

		rebuild_thumbs_info = QLabel("Clears thumbnail cache and rebuilds it, which can take a while. Tip: Useful when changing thumbnail size.")
		rebuild_thumbs_btn = QPushButton('Regenerate Thumbnails')
		rebuild_thumbs_btn.adjustSize()
		rebuild_thumbs_btn.setFixedWidth(rebuild_thumbs_btn.width())
		rebuild_thumbs_btn.clicked.connect(rebuild_thumbs)
		advanced_gallery_m_l.addRow(rebuild_thumbs_info)
		advanced_gallery_m_l.addRow(rebuild_thumbs_btn)
		g_data_fixer_group, g_data_fixer_l =  groupbox('Gallery Renamer', QFormLayout, advanced_gallery)
		g_data_fixer_group.setEnabled(False)
		advanced_gallery_m_l.addRow(g_data_fixer_group)
		g_data_regex_fix_lbl = QLabel("Rename a gallery through regular expression."+
								" A regex cheatsheet is located at About -> Regex Cheatsheet.")
		g_data_regex_fix_lbl.setWordWrap(True)
		g_data_fixer_l.addRow(g_data_regex_fix_lbl)
		self.g_data_regex_fix_edit = QLineEdit()
		self.g_data_regex_fix_edit.setPlaceholderText("Valid regex")
		g_data_fixer_l.addRow('Regex:', self.g_data_regex_fix_edit)
		self.g_data_replace_fix_edit = QLineEdit()
		self.g_data_replace_fix_edit.setPlaceholderText("Leave empty to delete matches")
		g_data_fixer_l.addRow('Replace with:', self.g_data_replace_fix_edit)
		g_data_fixer_options = FlowLayout()
		g_data_fixer_l.addRow(g_data_fixer_options)
		self.g_data_fixer_title = QCheckBox("Title", g_data_fixer_group)
		self.g_data_fixer_artist = QCheckBox("Artist", g_data_fixer_group)
		g_data_fixer_options.addWidget(self.g_data_fixer_title)
		g_data_fixer_options.addWidget(self.g_data_fixer_artist)

		# Advanced / Database
		advanced_db_page, advanced_db_page_l = new_tab('Database', advanced)
		# Advanced / Database / Import/Export
		def init_export():
			confirm_msg = QMessageBox(QMessageBox.Question, '', 'Are you sure you want to export your database? This might take a long time.',
							 QMessageBox.Yes | QMessageBox.No, self)
			if confirm_msg.exec() == QMessageBox.Yes:
				app_popup = ApplicationPopup(self.parent_widget)
				app_popup.info_lbl.setText("Exporting database...")
				app_popup.export_instance = io_misc.ImportExport()
				app_popup.export_instance.moveToThread(app_constants.GENERAL_THREAD)
				app_popup.export_instance.finished.connect(app_popup.export_instance.deleteLater)
				app_popup.export_instance.finished.connect(app_popup.close)
				app_popup.export_instance.amount.connect(app_popup.prog.setMaximum)
				app_popup.export_instance.progress.connect(app_popup.prog.setValue)
				self.init_gallery_eximport.connect(app_popup.export_instance.export_data)
				self.init_gallery_eximport.emit(None)
				app_popup.adjustSize()
				app_popup.show()
				self.close()

		def init_import():
			path = QFileDialog.getOpenFileName(self,
									  'Choose happypanda database file', filter='*.hpdb')
			path = path[0]
			if len(path) != 0:
				app_popup = ApplicationPopup(self.parent_widget)
				app_popup.restart_info.hide()
				app_popup.info_lbl.setText("Importing database file...")
				app_popup.note_info.setText("Application requires a restart after importing")
				app_popup.import_instance = io_misc.ImportExport()
				app_popup.import_instance.moveToThread(app_constants.GENERAL_THREAD)
				app_popup.import_instance.finished.connect(app_popup.import_instance.deleteLater)
				app_popup.import_instance.finished.connect(app_popup.init_restart)
				app_popup.import_instance.amount.connect(app_popup.prog.setMaximum)
				app_popup.import_instance.imported_g.connect(app_popup.info_lbl.setText)
				app_popup.import_instance.progress.connect(app_popup.prog.setValue)
				self.init_gallery_eximport.connect(app_popup.import_instance.import_data)
				self.init_gallery_eximport.emit(path)
				app_popup.adjustSize()
				app_popup.show()
				self.close()

		advanced_impexp, advanced_impexp_l = groupbox('Import/Export', QFormLayout, advanced_db_page)
		advanced_db_page_l.addRow(advanced_impexp)
		self.export_format = QComboBox(advanced_db_page)
		#self.export_format.addItem('Text File', 0)
		self.export_format.addItem('HPDB', 1)
		self.export_format.adjustSize()
		self.export_format.setFixedWidth(self.export_format.width())
		advanced_impexp_l.addRow('Export Format:', self.export_format)
		self.export_path = PathLineEdit(advanced_impexp, filters='')
		advanced_impexp_l.addRow('Export Path:', self.export_path)
		import_btn = QPushButton('Import database')
		import_btn.clicked.connect(init_import)
		export_btn = QPushButton('Export database')
		export_btn.clicked.connect(init_export)
		ex_imp_btn_l = QHBoxLayout()
		ex_imp_btn_l.addWidget(import_btn)
		ex_imp_btn_l.addWidget(export_btn)
		advanced_impexp_l.addRow(ex_imp_btn_l)


		# About
		about = QTabWidget(self)
		self.about_index = self.right_panel.addWidget(about)
		about_happypanda_page, about_layout = new_tab("About Happypanda", about, False)
		info_lbl = QLabel(app_constants.ABOUT)
		info_lbl.setWordWrap(True)
		info_lbl.setOpenExternalLinks(True)
		about_layout.addWidget(info_lbl)
		about_layout.addWidget(Spacer('v'))
		open_hp_folder = QPushButton('Open Happypanda Directory')
		open_hp_folder.clicked.connect(self.open_hp_folder)
		open_hp_folder.adjustSize()
		open_hp_folder.setFixedWidth(open_hp_folder.width())
		about_layout.addWidget(open_hp_folder)

		# About / DB Overview
		about_db_overview, about_db_overview_m_l = new_tab('DB Overview', about)
		about_stats_tab_widget = misc_db.DBOverview(self.parent_widget)
		about_db_overview_options = QHBoxLayout()
		self.tags_treeview_on_start = QCheckBox('Start with application', about_db_overview)
		make_window_btn = QPushButton('Open in window', about_db_overview)
		make_window_btn.adjustSize()
		make_window_btn.setFixedWidth(make_window_btn.width())
		about_db_overview_options.addWidget(self.tags_treeview_on_start)
		about_db_overview_options.addWidget(make_window_btn)
		def mk_btn_false():
			try:
				make_window_btn.setDisabled(False)
			except RuntimeError:
				pass
		def make_tags_treeview_window():
			self.parent_widget.tags_treeview = misc_db.DBOverview(self.parent_widget, True)
			self.parent_widget.tags_treeview.about_to_close.connect(mk_btn_false)
			make_window_btn.setDisabled(True)
			self.parent_widget.tags_treeview.show()
		if self.parent_widget.tags_treeview:
			self.parent_widget.tags_treeview.about_to_close.connect(mk_btn_false)
			make_window_btn.setDisabled(True)
		make_window_btn.clicked.connect(make_tags_treeview_window)
		about_db_overview_m_l.addRow(about_db_overview_options)
		about_db_overview_m_l.addRow(about_stats_tab_widget)

		# About / Troubleshooting
		about_troubleshoot_page = QWidget()
		about.addTab(about_troubleshoot_page, 'Bug Reporting')
		troubleshoot_layout = QVBoxLayout()
		about_troubleshoot_page.setLayout(troubleshoot_layout)
		guide_lbl = QLabel(app_constants.TROUBLE_GUIDE)
		guide_lbl.setTextFormat(Qt.RichText)
		guide_lbl.setOpenExternalLinks(True)
		guide_lbl.setWordWrap(True)
		troubleshoot_layout.addWidget(guide_lbl, 0, Qt.AlignTop)
		troubleshoot_layout.addWidget(Spacer('v'))

		# About / Search tutorial
		about_search_tut, about_search_tut_l = new_tab("Search Guide", about, True)
		g_search_lbl = QLabel(app_constants.SEARCH_TUTORIAL_TAGS)
		g_search_lbl.setWordWrap(True)
		about_search_tut_l.addRow(g_search_lbl)

		# About / Regex Cheatsheet
		about_s_regex, about_s_regex_l = new_tab("Regex Cheatsheet", about, True)
		reg_info = QLabel(app_constants.REGEXCHEAT)
		reg_info.setWordWrap(True)
		about_s_regex_l.addRow(reg_info)
コード例 #2
0
    def __init__(self, win_name, scan, upper_level, lower_level):
        super(Dialog_Windowing, self).__init__()

        # Passing the current values if it is an existing option or empty if its a new one
        self.win_name = win_name
        self.setWindowIcon(QtGui.QIcon("src/Icon/DONE.png"))
        self.scan = scan
        self.upper_level = upper_level
        self.lower_level = lower_level

        # Create the ui components for the inputs
        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.name = QLineEdit()
        self.name.setText(self.win_name)
        self.scan_text = QLineEdit()
        self.scan_text.setText(self.scan)
        self.upper_level_text = QLineEdit()
        self.upper_level_text.setText(self.upper_level)
        self.lower_level_text = QLineEdit()
        self.lower_level_text.setText(self.lower_level)
        layout = QFormLayout(self)
        layout.addRow(QLabel("Window Name:"), self.name)
        layout.addRow(QLabel("Scan:"), self.scan_text)
        layout.addRow(QLabel("Upper Value:"), self.upper_level_text)
        layout.addRow(QLabel("Lower Value:"), self.lower_level_text)
        layout.addWidget(button_box)
        button_box.accepted.connect(self.accepting)
        button_box.rejected.connect(self.reject)
        self.setWindowTitle("Image Windowing")
コード例 #3
0
    def __init__(self, Name, id, organ, url):
        super(Dialog_Organ, self).__init__()

        #passing the current values if it is an existing option or empty if its a new one
        self.name = Name
        self.setWindowIcon(QtGui.QIcon("src/Icon/DONE.png"))
        self.id = id
        self.org = organ
        self.url = url

        #creating the UI components
        buttonBox = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.S_name = QLineEdit()
        self.S_name.setText(self.name)
        self.oID = QLineEdit()
        self.oID.setText(self.id)
        self.organ = QLineEdit()
        self.organ.setText(self.org)
        self._url = QLineEdit()
        self._url.setText(self.url)
        layout = QFormLayout(self)
        layout.addRow(QLabel("Standard Name:"), self.S_name)
        layout.addRow(QLabel("FMA ID:"), self.oID)
        layout.addRow(QLabel("Organ:"), self.organ)
        layout.addRow(QLabel("Url:"), self._url)
        layout.addWidget(buttonBox)
        buttonBox.accepted.connect(self.accepting)
        buttonBox.rejected.connect(self.reject)
        self.setWindowTitle("Standard Organ Names")
コード例 #4
0
    def __init__(self, labels, parent=None):

        QDialog.__init__(self, parent)

        channels = QGroupBox()

        self.selection1 = QComboBox()
        self.selection1.addItems(labels)
        self.selection2 = QComboBox()
        self.selection2.addItems(labels)
        self.selection3 = QLineEdit()

        layout = QFormLayout()
        layout.addRow(QLabel("Channel 1:"), self.selection1)
        layout.addRow(QLabel("Channel 2:"), self.selection2)
        layout.addRow(QLabel("Output Label:"), self.selection3)

        channels.setLayout(layout)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.accept)
        button_box.rejected.connect(self.reject)

        layout = QVBoxLayout()
        layout.addWidget(channels)
        layout.addWidget(button_box)

        self.setWindowTitle("Channel Difference")
        self.setLayout(layout)
コード例 #5
0
ファイル: bacardi.py プロジェクト: nixis-institute/practice
    def createFormGroupBox(self):
        self.formGroupBox = QGroupBox("Add Product")
        layout = QFormLayout()

        self.submit_btn = QPushButton("Submit")
        self.itemName = QLineEdit()
        self.qty = QLineEdit()

        self.expiry_date = QDateEdit()
        self.expiry_date.setCalendarPopup(True)
        self.expiry_date.setMinimumDate(QDate.currentDate())

        # yr = datetime.datetime.today().year
        # dt = QDate()
        # dt.getDate()

        self.price = QLineEdit()
        self.purchase_from = QLineEdit()
        self.GST = QLineEdit()
        layout.addRow(QLabel("Item Name:"), self.itemName)
        layout.addRow(QLabel("Quantity:"), self.qty)

        self.type_of_packing = QComboBox()
        self.type_of_packing.addItem("Packets")
        self.type_of_packing.addItem("Tablets")
        self.type_of_packing.addItem("Carton")
        layout.addRow(QLabel("Type"), self.type_of_packing)

        layout.addRow(QLabel("Expiry Date:"), self.expiry_date)
        layout.addRow(QLabel("Price:"), self.price)
        layout.addRow(QLabel("Purchase from:"), self.purchase_from)
        layout.addRow(QLabel("GST:"), self.GST)
        layout.addWidget(self.submit_btn)
        self.formGroupBox.setLayout(layout)
コード例 #6
0
ファイル: DeviceConfig.py プロジェクト: rodcnx/tdm
    def tabModule(self):
        module = QWidget()
        module.setLayout(HLayout())

        self.gbModule = GroupBoxH("Module")
        self.cbModule = QComboBox()
        self.pbModuleSet = QPushButton("Save and close (device will restart)")
        self.gbModule.addWidgets([self.cbModule, self.pbModuleSet])
        self.pbModuleSet.clicked.connect(self.saveModule)

        self.gbGPIO = QGroupBox("GPIO")
        fl_gpio = QFormLayout()
        pbGPIOSet = QPushButton("Save and close (device will restart)")
        fl_gpio.addWidget(pbGPIOSet)
        pbGPIOSet.clicked.connect(self.saveGPIOs)

        self.gbGPIO.setLayout(fl_gpio)

        mg_vl = VLayout([0, 0, 3, 0])
        mg_vl.addWidgets([self.gbModule, self.gbGPIO])
        mg_vl.setStretch(0, 1)
        mg_vl.setStretch(1, 3)

        self.gbFirmware = GroupBoxV("Firmware", margin=[3, 0, 0, 0])
        lb = QLabel("Feature under development.")
        lb.setAlignment(Qt.AlignCenter)
        lb.setEnabled(False)
        self.gbFirmware.addWidget(lb)

        module.layout().addLayout(mg_vl)
        module.layout().addWidget(self.gbFirmware)
        return module
コード例 #7
0
class LabelNameDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.init_ui()
        self.save_button.clicked.connect(parent.saveimg)

    def init_ui(self):
        self.setModal(True)
        self.setWindowIcon(QIcon(":icons/set_roi.png"))
        self.setWindowTitle("设置地标")
        self.form_layout = QFormLayout()

        no_label = QLabel("编号:")
        self.no_edit = QLineEdit()
        self.no_edit.setPlaceholderText(r"例如:2,从上到下2号位,左右对称位置同编号")
        self.form_layout.addRow(no_label, self.no_edit)

        direct_label = QLabel("左侧还是右侧:")
        self.direct_edit = QLineEdit()
        self.direct_edit.setPlaceholderText('L:左侧,R:右侧')
        self.form_layout.addRow(direct_label, self.direct_edit)

        self.save_button = QPushButton('保存')

        self.form_layout.addWidget(self.save_button)
        self.setLayout(self.form_layout)
コード例 #8
0
ファイル: PluginView.py プロジェクト: mdavis199/MergeWizard
    def moveTo(self, indexes: List[QModelIndex]):
        if len(indexes) == 0:
            return
        dlg = QDialog()
        dlg.setWindowTitle(self.tr("Insert Plugins"))
        layout = QFormLayout(dlg)
        spinBox = QSpinBox()
        spinBox.setRange(1, self.model().rowCount())
        spinBox.setAccelerated(True)
        spinBox.setMaximumWidth(100)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(dlg.accept)
        buttonBox.rejected.connect(dlg.reject)
        layout.addRow(self.tr("Position:"), spinBox)
        layout.addWidget(buttonBox)

        if dlg.exec() == QDialog.Accepted:
            idx = indexes[0]
            currentValue = idx.model().data(idx.siblingAtColumn(0),
                                            Qt.EditRole)
            newValue = spinBox.value() - 1
            if newValue == currentValue:
                return
            if newValue > currentValue:
                newValue = newValue + 1
            self._models.pluginModel.setPluginsOrder(
                self._models.indexesForModel(indexes,
                                             self._models.pluginModel),
                newValue,
            )
コード例 #9
0
    def createChartView(
            self, _x2idx: dict, _idx2x: list
    ) -> QHBoxLayout:
        chart = QChart()

        # assign y range
        self.calcRangeY()
        self.setAxisY(self.begin_y, self.end_y)

        value_layout = QFormLayout()
        # add each series
        for v in self.series_table.values():
            v.addSeries(_x2idx, _idx2x, chart, self.axis_x, self.axis_y)
            if v.show_value:
                value_layout.addWidget(v.show_group)

        # create chartview and layout for view and value
        chartview = ChartView(chart, self.wizard)
        chartview.setRenderHint(QPainter.Antialiasing)

        global_layout = QHBoxLayout()
        global_layout.addWidget(chartview, self.chart_stretch)
        global_layout.addLayout(value_layout)

        return global_layout
コード例 #10
0
    def __init__(self, timestamp, topic, payload, *args, **kwargs):
        super(PayloadViewDialog, self).__init__(*args, **kwargs)
        self.setMinimumWidth(500)
        self.setWindowTitle("View payload")

        fl = QFormLayout()

        lb_timestamp = QLabel(timestamp)

        le_topic = QLineEdit()
        le_topic.setReadOnly(True)
        le_topic.setText(topic)

        fnt_mono = QFontDatabase.systemFont(QFontDatabase.FixedFont)

        pte_payload = QPlainTextEdit()
        pte_payload.setFont(fnt_mono)
        pte_payload.setMinimumHeight(400)
        pte_payload.setReadOnly(True)
        if payload:
            payload = str(payload)
            if payload.startswith("{") or payload.startswith("["):
                pte_payload.setPlainText(dumps(loads(payload), indent=2))
            else:
                pte_payload.setPlainText(payload)
        else:
            pte_payload.setPlainText("(empty)")

        fl.addWidget(lb_timestamp)
        fl.addRow("Topic", le_topic)
        fl.addRow("Payload", pte_payload)

        self.setLayout(fl)
    def initUI(self):
        options = QFileDialog.Options()
        fileName, _ = QFileDialog.getOpenFileNames(self,
                                                   "选取文件",
                                                   "E:",
                                                   "气象数据文件 (*.DAT);;",
                                                   options=options)
        process_file(*fileName)

        centralWidget = QWidget()
        self.setWindowTitle('吉布提气象数据处理系统(三航院)')
        self.load_file_Button = QPushButton("数据处理结束,点击结束程序")
        self.load_file_Button.setStyleSheet("""
               QPushButton
               {
                   background-color: rgb(255, 255,255);
                   border:3px solid rgb(170, 170, 170);
               }
               """)
        self.load_file_Button.setFixedHeight(50)
        self.load_file_Button.setFixedWidth(305)
        font = QFont()
        font.setBold(True)
        font.setPointSize(15)
        self.load_file_Button.setFont(font)
        self.load_file_Button.clicked.connect(self.closeEvent)
        layout = QFormLayout()
        layout.addWidget(self.load_file_Button)
        centralWidget.setLayout(layout)
        self.setCentralWidget(centralWidget)
コード例 #12
0
    def init_ui(self):
        self.resize(350, 100)
        self.setWindowTitle("添加")
        layout = QFormLayout()
        self.setLayout(layout)
        store_label = QLabel('店铺账号:')
        self.store_input = QLineEdit()
        reg = QRegExp("[a-zA-Z0-9_]+$")
        store_validator = QRegExpValidator(self)
        store_validator.setRegExp(reg)
        self.store_input.setValidator(store_validator)
        cookies_label = QLabel('cookies')
        self.cookies_input = QTextEdit()
        layout.addRow(store_label, self.store_input)
        layout.addRow(cookies_label, self.cookies_input)

        button_frame = QFrame()
        button_layout = QHBoxLayout()
        button_frame.setLayout(button_layout)

        accept_button = QPushButton('确认')
        accept_button.clicked.connect(self.accept)

        reject_button = QPushButton('关闭')
        reject_button.clicked.connect(self.reject)

        button_layout.addWidget(accept_button)
        button_layout.addWidget(reject_button)

        layout.addWidget(button_frame)
コード例 #13
0
ファイル: UpdateForm.py プロジェクト: VirtualRoyalty/FindApp
    def initUI(self, main_window):
        main_window.name = QLineEdit()
        main_window.lastname = QLineEdit()
        main_window.age = QLineEdit()
        """setting validators"""
        reg_ex = QRegExp("([A-Z][a-z]{20})|([А-Я][а-я]{20})")
        input_validator = QRegExpValidator(reg_ex, main_window.name)
        input_validator = QRegExpValidator(reg_ex, main_window.lastname)
        main_window.name.setValidator(input_validator)
        main_window.lastname.setValidator(input_validator)
        reg_ex = QRegExp("[1-9][0-9]")
        input_validator = QRegExpValidator(reg_ex, main_window.age)
        main_window.age.setValidator(input_validator)

        layout = QFormLayout()
        layout.addRow('Name:', main_window.name)
        layout.addRow('Lastname:', main_window.lastname)
        layout.addRow('Age:', main_window.age)

        QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        self.buttonBox = QDialogButtonBox(QBtn)
        self.buttonBox.accepted.connect(main_window.acceptUpdate)
        self.buttonBox.rejected.connect(main_window.update_form.reject)
        layout.addWidget(self.buttonBox)

        main_window.update_form.setLayout(layout)
        main_window.update_form.exec()
コード例 #14
0
    def __init__(self, standard_name, fma_id, organ, url):
        super(Dialog_Organ, self).__init__()

        # Passing the current values if it is an existing option or empty if its a new one
        self.standard_name = standard_name
        self.setWindowIcon(QtGui.QIcon("src/Icon/DONE.png"))
        self.fma_id = fma_id
        self.organ = organ
        self.url = url

        # Creating the UI components
        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.standard_name_header = QLineEdit()
        self.standard_name_header.setText(self.standard_name)
        self.fma_id_header = QLineEdit()
        self.fma_id_header.setText(self.fma_id)
        self.organ_header = QLineEdit()
        self.organ_header.setText(self.organ)
        self.url_header = QLineEdit()
        self.url_header.setText(self.url)
        layout = QFormLayout(self)
        layout.addRow(QLabel("Standard Name:"), self.standard_name_header)
        layout.addRow(QLabel("FMA ID:"), self.fma_id_header)
        layout.addRow(QLabel("Organ:"), self.organ_header)
        layout.addRow(QLabel("Url:"), self.url_header)
        layout.addWidget(button_box)
        button_box.accepted.connect(self.accepting)
        button_box.rejected.connect(self.reject)
        self.setWindowTitle("Standard Organ Names")
コード例 #15
0
    def stack1UI(self):
        layout = QFormLayout()


        self.ok = QPushButton('Add Stock', self)
        cancel = QPushButton('Cancel', self)

        self.stock_name = QLineEdit()
        layout.addRow("Stock Name", self.stock_name)

        self.stock_count = QLineEdit()
        layout.addRow("Quantity", self.stock_count)

        self.stock_cost = QLineEdit()
        layout.addRow("Cost of Stock (per item)", self.stock_cost)

        layout.addWidget(self.ok)
        layout.addWidget(cancel)

        self.ok.clicked.connect(self.on_click)

        cancel.clicked.connect(self.stock_name.clear)
        cancel.clicked.connect(self.stock_cost.clear)
        cancel.clicked.connect(self.stock_count.clear)
        self.stack1.setLayout(layout)
コード例 #16
0
    def leftFrame(self):
        #创建FRAME
        leftframe = QFrame(self.centralwidget)
        leftframe.resize(600, 130)
        leftframe.setMaximumWidth(130)
        leftframe.setStyleSheet("background-color:green;border:0px")

        l_layout = QFormLayout(self)

        btn_1 = QPushButton("A")
        btn_1.setFixedSize(100, 30)  #固定尺寸
        btn_1.setIcon(QApplication.style().standardIcon(
            QStyle.StandardPixmap(27)))
        btn_1.clicked.connect(lambda: self.onClick(btn_1.text()))

        btn_2 = QPushButton("B")
        btn_2.setFixedSize(100, 30)
        btn_2.setIcon(QApplication.style().standardIcon(
            QStyle.StandardPixmap(27)))
        btn_2.clicked.connect(lambda: self.onClick(btn_2.text()))

        l_layout.addWidget(btn_1)
        l_layout.addWidget(btn_2)
        leftframe.setLayout(l_layout)
        return leftframe
コード例 #17
0
    def __init__(self, main_window):
        super().__init__(main_window)
        self.main_window = main_window
        self.project = main_window.project
        self.setWindowTitle('Edit Stage 1.2 - 1.4 Chart Options')

        l = QFormLayout(self)
        speed_lower_label = QLabel('Lower Limit Speed (mph): ')
        speed_lower_label.setFont(QFont("Times", weight=QFont.Bold))
        self.speed_lower_input = QSpinBox()
        self.speed_lower_input.setRange(5, 100)
        self.speed_lower_input.setValue(int(self.project.min_speed))
        self.speed_lower_input.setSingleStep(5)
        self.speed_lower_input.setSuffix(' mph')
        speed_upper_label = QLabel('Upper Limit Speed (mph): ')
        speed_upper_label.setFont(QFont("Times", weight=QFont.Bold))
        self.speed_upper_input = QSpinBox()
        self.speed_upper_input.setRange(5, 100)
        self.speed_upper_input.setValue(int(self.project.max_speed))
        self.speed_upper_input.setSingleStep(5)
        self.speed_upper_input.setSuffix(' mph')
        l.addRow(speed_lower_label, self.speed_lower_input)
        l.addRow(speed_upper_label, self.speed_upper_input)
        buttons = QDialogButtonBox(Qt.Horizontal, self)
        buttons.addButton(QDialogButtonBox.Ok)
        buttons.addButton(QDialogButtonBox.Cancel)
        buttons.accepted.connect(self.ok_press)
        buttons.rejected.connect(self.close_press)
        l.addWidget(buttons)
コード例 #18
0
    def __init__(self, main_window):
        super().__init__(main_window)
        self.main_window = main_window
        self.project = main_window.project
        self.setWindowTitle('Edit Trend Time Periods')

        l = QFormLayout(self)
        title_label = QLabel('Specify start and end times for each period:')
        title_label.setFont(QFont("Times", weight=QFont.Bold))
        midnight = datetime.datetime(2000, 1, 1, 0, 0, 0)
        ap_list = [
            (midnight + datetime.timedelta(minutes=self.project.data_res *
                                           i)).strftime('%I:%M%p')
            for i in range(24 * 60 // self.project.data_res)
        ]
        p1_start_label = QLabel('AM (Period 1) Start:')
        p1_start_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p1_start_cb = QComboBox()
        self.p1_start_cb.addItems(ap_list)
        p1_end_label = QLabel('AM (Period 1) End:')
        p1_end_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p1_end_cb = QComboBox()
        self.p1_end_cb.addItems(ap_list)
        p2_start_label = QLabel('Midday (Period 2) Start:')
        p2_start_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p2_start_cb = QComboBox()
        self.p2_start_cb.addItems(ap_list)
        p2_end_label = QLabel('Midday (Period 2) End:')
        p2_end_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p2_end_cb = QComboBox()
        self.p2_end_cb.addItems(ap_list)
        p3_start_label = QLabel('PM (Period 3) Start:')
        p3_start_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p3_start_cb = QComboBox()
        self.p3_start_cb.addItems(ap_list)
        p3_end_label = QLabel('PM (Period 3) End:')
        p3_end_label.setFont(QFont("Times", weight=QFont.Bold))
        self.p3_end_cb = QComboBox()
        self.p3_end_cb.addItems(ap_list)

        self.p1_start_cb.setCurrentIndex(self.project.p1_ap_start)
        self.p1_end_cb.setCurrentIndex(self.project.p1_ap_end)
        self.p2_start_cb.setCurrentIndex(self.project.p2_ap_start)
        self.p2_end_cb.setCurrentIndex(self.project.p2_ap_end)
        self.p3_start_cb.setCurrentIndex(self.project.p3_ap_start)
        self.p3_end_cb.setCurrentIndex(self.project.p3_ap_end)

        l.addRow(title_label)
        l.addRow(p1_start_label, self.p1_start_cb)
        l.addRow(p1_end_label, self.p1_end_cb)
        l.addRow(p2_start_label, self.p2_start_cb)
        l.addRow(p2_end_label, self.p2_end_cb)
        l.addRow(p3_start_label, self.p3_start_cb)
        l.addRow(p3_end_label, self.p3_end_cb)
        buttons = QDialogButtonBox(Qt.Horizontal, self)
        buttons.addButton(QDialogButtonBox.Ok)
        buttons.addButton(QDialogButtonBox.Cancel)
        buttons.accepted.connect(self.ok_press)
        buttons.rejected.connect(self.close_press)
        l.addWidget(buttons)
コード例 #19
0
ファイル: complex.py プロジェクト: desolovev/SimplePyScripts
    def __init__(self):
        super().__init__()

        self.line_edit_url = QLineEdit(
            'https://codeload.github.com/gil9red/SimplePyScripts/zip/master')
        self.line_edit_file_name = QLineEdit('SimplePyScripts.zip')

        self.button_download = QPushButton('Download')
        self.button_download.clicked.connect(self.download)

        self.text_edit_log = QTextEdit()

        layout = QFormLayout()
        layout.addRow('URL:', self.line_edit_url)
        layout.addRow('File Name:', self.line_edit_file_name)
        layout.addWidget(self.button_download)
        layout.addWidget(self.text_edit_log)

        self.thread = ThreadDownload()
        self.thread.started.connect(
            lambda: self.button_download.setEnabled(False))
        self.thread.finished.connect(
            lambda: self.button_download.setEnabled(True))
        self.thread.about_progress.connect(self._handle_about_progress)
        self.thread.about_file_name.connect(self._handle_about_file_name)
        self.thread.about_error.connect(self._handle_about_error)

        self.setLayout(layout)
コード例 #20
0
    def __init__(self, *args, **kwargs):
        super(CustomDialog, self).__init__(*args, **kwargs)
        
        self.setWindowTitle("Change Value one cell")
        self.setGeometry(100,100, 500,200)
        
        self.entry1 = QLineEdit()
        self.entry1.setValidator(QtGui.QIntValidator())
        self.entry1.setMaxLength(4)
        self.entry1.setAlignment(Qt.AlignRight)
        
#        self.entry2 = QLineEdit()
#        self.entry2.setValidator(QtGui.QIntValidator())
#        self.entry2.setMaxLength(4)
#        self.entry2.setAlignment(Qt.AlignRight)
        
        flo = QFormLayout()
        flo.addRow('Enter Cell value (integer):', self.entry1)
#        flo.addRow('Enter Cell value 2 (integer):', self.entry2)        
        
        QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        
        self.buttonBox = QDialogButtonBox(QBtn)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

#        self.layout = QVBoxLayout()
#        self.layout.addWidget(self.buttonBox
        flo.addWidget(self.buttonBox)
        self.setLayout(flo)
        
コード例 #21
0
    def createSettingsForm(self):
        getUserSettings()
        settingsFormLayout = QFormLayout()

        self.dailyAllowance = QLineEdit()
        self.dailyAllowance.setText(str(dailyAllowanceValue))

        self.userEmail = QLineEdit()
        self.userEmail.setText(str(userEmail))

        self.b1 = QRadioButton("Light Mode")
        self.b1.toggled.connect(lambda: self.setTheme('light'))

        self.b2 = QRadioButton("Dark Mode")
        self.b2.toggled.connect(lambda: self.setTheme('dark'))

        if (theme == 'light'):
            self.b1.setChecked(True)
        elif (theme == 'dark'):
            self.b2.setChecked(True)

        settingsFormLayout.addRow('Daily Limit: ', self.dailyAllowance)
        settingsFormLayout.addRow("User Email", self.userEmail)

        settingsFormLayout.addRow('Theme: ', self.b1)
        settingsFormLayout.addWidget(self.b2)
        self.settingsForm = settingsFormLayout
コード例 #22
0
ファイル: main.py プロジェクト: Lioheart/Weterynarz
    def initUI(self):
        """
        Inicjalizuje UI
        """
        lbllogin = QLabel('Użytkownik:')
        lblhaslo = QLabel('Hasło:')
        self.txthaslo.setEchoMode(QLineEdit.Password)

        # Do USUNIECIA
        # self.txtlogin.setText('admin')
        # self.txthaslo.setText('123')

        # Ustawienie własnych przycisków
        self.buttonBox.addButton('Zaloguj', QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton('Anuluj', QDialogButtonBox.RejectRole)

        fbox = QFormLayout()
        fbox.addRow(lbllogin, self.txtlogin)
        fbox.addRow(lblhaslo, self.txthaslo)
        fbox.addWidget(self.buttonBox)
        self.setLayout(fbox)

        self.setWindowTitle('Logowanie')
        self.setFixedSize(300, 100)
        self.setWhatsThis('<h3>Pole logowania</h3>')

        self.buttonBox.accepted.connect(self.login)
        self.buttonBox.rejected.connect(self.cancel)
        self.show()
コード例 #23
0
    def __init__(self, mode_teste):
        super().__init__()
        self.children = []
        self.mode_teste = mode_teste

        self.setWindowTitle("Ajouter Produit de Risque")
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowIcon(QIcon(app.utilities.get_path("docs/images/icon.png")))

        layout = QFormLayout()

        self.id_prod = QLineEdit()
        layout.addRow(QLabel("Id Produit"), self.id_prod)
        self.marque_prod = QLineEdit()
        layout.addRow(QLabel("Marque Produit"), self.marque_prod)
        self.nom_prod = QLineEdit()
        layout.addRow(QLabel("Nom Produit"), self.nom_prod)

        buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addWidget(buttons)

        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        self.setLayout(layout)
コード例 #24
0
ファイル: qtutils.py プロジェクト: licit-lab/symupy
class ODSelector(QDialog):
    def __init__(self, func, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Choose OD")

        self.layout = QFormLayout()
        self.setLayout(self.layout)

        sig = signature(func)
        self.widgets = list()
        maxsize = max([len(item) for item in sig.parameters.keys()])
        for name, param in sig.parameters.items():
            label = QLabel(name)
            edit = QLineEdit()
            self.widgets.append(edit)
            self.layout.addRow(label, edit)
            if param.default != _empty:
                edit.setText(str(param.default))

        self.button_select = QPushButton("Select")
        self.layout.addWidget(self.button_select)
        self.button_select.clicked.connect(self.select)

        self.values = list()

    def select(self):
        for line_edit in self.widgets:
            self.values.append(line_edit.text())
        self.accept()
コード例 #25
0
    def __init__(self, parent=None, tabList=None, initial=None):
        super(sideViewSwitchDialog, self).__init__(parent=parent)
        self.tabList = tabList
        self.returnVal = initial
        self.initial = initial

        dialogBoxLayout = QFormLayout(self)
        tabListComboBox = QComboBox()
        tabListComboBox.addItems(self.tabList)
        tabListComboBox.activated[str].connect(
            lambda x: setattr(self, 'returnVal', self.tabList.index(x)))
        tabLabel = QLabel("Change Side View")
        tabLabel.setBuddy(tabListComboBox)  # label for the above combo box
        tabListComboBox.setCurrentIndex(self.returnVal)
        dialogBoxLayout.setWidget(1, QFormLayout.LabelRole, tabLabel)
        dialogBoxLayout.setWidget(1, QFormLayout.FieldRole, tabListComboBox)

        # add ok and cancel buttons
        buttonBox = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        dialogBoxLayout.addWidget(buttonBox)
        self.setLayout(dialogBoxLayout)
        self.resize(300, 100)  #resize to a certain size
コード例 #26
0
class Init(QMainWindow, Ui_MainWindow):
    close_signal = pyqtSignal()

    def __init__(self, parent=None):
        super(Init, self).__init__(parent)
        self.setupUi(self)

        self.lineEdit_2.setContextMenuPolicy(Qt.NoContextMenu)
        self.lineEdit_2.setEchoMode(QLineEdit.Password)
        self.formLayout = QFormLayout()  # The register's widget

    @pyqtSlot()
    def on_loginButton_clicked(self):
        acount = self.lineEdit_1.text()
        passwd = self.lineEdit_2.text()
        print(acount, passwd)
        QMessageBox.about(self, 'Login', "Waiting to achieve this function")

    @pyqtSlot()
    def on_changePasswordButton_clicked(self):
        register = Register()
        self.formLayout.addWidget(register)
        register.show()

    def closeEvent(self, event):
        self.close_signal.emit()
        self.close()
コード例 #27
0
    def createFormGroupBox(self):
        self.formGroupBox = QGroupBox()
        self.genGroup = QButtonGroup(self.formGroupBox)
        self.goalGroup = QButtonGroup(self.formGroupBox)
        self.genGroup.addButton(self.r1)
        self.genGroup.addButton(self.r2)
        self.goalGroup.addButton(self.goal1)
        self.goalGroup.addButton(self.goal2)
        self.goalGroup.addButton(self.goal3)
        layout = QFormLayout()
        self.hbox.addWidget(self.r1)
        self.hbox.addWidget(self.r2)
        self.hbox.addStretch()
        self.gbox.addWidget(self.goal1)
        self.gbox.addWidget(self.goal2)
        self.gbox.addWidget(self.goal3)
        self.gbox.addStretch()

        layout.addRow(QLabel("Full Name:"), self.nameLabel)
        layout.addRow(QLabel("Age:"), self.ageLabel)
        layout.addRow(QLabel("Height:   (feet)"), self.feetLabel)
        layout.addRow(QLabel("          (inches)"), self.inchesLabel)
        layout.addRow(QLabel("Weight:"), self.weightLabel)
        layout.addRow(QLabel("Workout Goal:"), self.gbox)
        layout.addRow(QLabel("Gender:"), self.hbox)
        layout.addRow(QLabel("Output File Name:"), self.fileLabel)
        layout.addWidget(QLabel("(without file extension)"))
        self.formGroupBox.setLayout(layout)
コード例 #28
0
ファイル: GPIO.py プロジェクト: awwolf/tdm
    def __init__(self, device, *args, **kwargs):
        super(GPIODialog, self).__init__(*args, **kwargs)
        self.setWindowTitle("GPIO [{}]".format(device.p['FriendlyName1']))
        self.setMinimumWidth(300)
        self.device = device

        self.gb = {}

        btns = QDialogButtonBox(QDialogButtonBox.Close)
        btns.rejected.connect(self.reject)

        gbxGPIO = QGroupBox("Select GPIO")
        fl = QFormLayout()
        if self.device.gpio:
            btns.addButton(QDialogButtonBox.Save)
            btns.accepted.connect(self.accept)

            for gp_name, gp_id in self.device.gpio.items():
                gb = DictComboBox(self.device.gpios)
                gb.setCurrentText(self.device.gpios[gp_id])
                self.gb[gp_name] = gb
                fl.addRow(gp_name, gb)
        else:
            fl.addWidget(QLabel("No configurable GPIOs"))
        gbxGPIO.setLayout(fl)

        vl = VLayout()
        vl.addWidgets([gbxGPIO, btns])
        self.setLayout(vl)
コード例 #29
0
    def __init__(self, server_obj):
        super(ClearHistory, self).__init__()
        self.setWindowTitle("Caution!")
        icon = QtGui.QIcon("caution.png")
        self.setWindowIcon(icon)
        self.resize(450, 100)
        self.server_obj = server_obj
        self.username = QLineEdit()
        self.password = QLineEdit()
        self.label = QLabel()
        self.label.setText(
            "<b><font color=red>Careful! You are about to clear the DoPQ History."
            "</font><br>Provide <font color=green>Username</font> and <font color=green>Password</font> to proceed ...</b>"
        )
        form_layout = QFormLayout()
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        form_layout.addWidget(self.label)
        form_layout.addRow("<font color=#00008b><b>Username: </b></font>",
                           self.username)
        form_layout.addRow("<font color=#00008b><b>Password: </b></font>",
                           self.password)
        form_layout.addWidget(buttonBox)
        self.setLayout(form_layout)

        buttonBox.accepted.connect(self.get_input)
        buttonBox.rejected.connect(self.close_diaglog)
        self.show()
コード例 #30
0
ファイル: group.py プロジェクト: BingoTra/HearSheeps
    def __init__(self, parent=None, session=None, token=None):
        super().__init__(parent, Qt.Window)
        self.sizeMonitor = QApplication.desktop().availableGeometry()
        self.setGeometry(self.sizeMonitor.width() / 6, 0,
                         (2 * self.sizeMonitor.width()) / 3,
                         self.sizeMonitor.height())

        myForm = QFormLayout()

        # Create scroll and put in general layout
        scrollWidget = QWidget()
        scrollWidget.setLayout(myForm)
        scroll = QScrollArea()
        scroll.setWidget(scrollWidget)
        scroll.setWidgetResizable(True)
        layout = QVBoxLayout(self)
        layout.addWidget(scroll)

        downloader = DownloadDecorator(session)
        api = API(session, token)

        groups = api.groups.get(extended=1)
        for group in groups['response']['items']:
            downloader(group["photo_100"], 'None', 'group', group['name'],
                       group['id'])

        download = downloader.download()
        for item in download:
            g = Group(session=session, token=token)
            g.setGroup(item[0].content, item[3][0], item[3][1])
            myForm.addWidget(g)

        self.show()
コード例 #31
0
ファイル: view.py プロジェクト: PyQtWorks/PyQtNetworkView
    def __init__(self, parent=None):
        super().__init__(parent)

        if USE_OPENGL and not isRemoteSession():
            fmt = QSurfaceFormat()
            fmt.setSamples(4)
            self.setViewport(QOpenGLWidget())
            self.viewport().setFormat(fmt)
            self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate)
        else:
            self.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate)

        layout = QFormLayout(self)
        layout.setContentsMargins(0, 0, 6, 0)
        layout.setFormAlignment(Qt.AlignRight | Qt.AlignBottom)
        self.minimap = MiniMapGraphicsView(self)
        layout.addWidget(self.minimap)
        self.setLayout(layout)

        self.setCacheMode(QGraphicsView.CacheBackground)
        self.setRenderHint(QPainter.Antialiasing)
        self.setTransformationAnchor(QGraphicsView.AnchorUnderMouse)
        self.setResizeAnchor(QGraphicsView.AnchorViewCenter)
        
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setOptimizationFlags(QGraphicsView.DontSavePainterState | QGraphicsView.DontAdjustForAntialiasing)

        self.setStyleSheet(
            """NetworkView:focus {
                border: 3px solid palette(highlight);
            }""")
コード例 #32
0
 def createShow(self):
     self.show_group = QGroupBox()
     self.show_group.setTitle(self.name)
     self.show_edit = QLineEdit()
     self.show_edit.setDisabled(True)
     layout = QFormLayout()
     layout.addWidget(self.show_edit)
     self.show_group.setLayout(layout)
コード例 #33
0
ファイル: configdialog.py プロジェクト: Diegojnb/JdeRobot
    def __init__(self, title, config):
        QDialog.__init__(self)
        if config is not None:
            self.type = config.type
        else:
            self.type = JDEROBOTCOMM

        self.setWindowTitle(title)
        commSelectionBox = QGroupBox('Select Communication Interface')
        commSelectionBox.setObjectName('commInterface')
        # add new config input fields
        fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.commTypeCombo = QComboBox()
        self.commTypeCombo.setFont(fixedWidthFont)
        self.commTypeCombo.setMaximumWidth(220)
        boxLayout = QVBoxLayout()
        boxLayout.addWidget(self.commTypeCombo)
        commSelectionBox.setLayout(boxLayout)
        vLayout = QFormLayout()
        vLayout.addWidget(commSelectionBox)

        self.configsLayout = QVBoxLayout()
        self.configsBox = QGroupBox('')
        self.configsBox.setLayout(self.configsLayout)
        vLayout.addWidget(self.configsBox)

        self.setLayout(vLayout)
        self.resize(700, 500)
        #self.setStyleSheet('QGroupBox#commInterface { border: 1px solid black; border-radius: 4px; padding:15px;} QGroupBox::title#commInterface {background-color:transparent; padding-left:25px; padding-top:5px;} ')

        self.rosConfigsUI = RosConfigDialog('ROS Communication')
        self.rosConfigsUI.configChanged.connect(self.configChangedHandler)
        self.configsLayout.addWidget(self.rosConfigsUI)
        self.rosConfigsUI.setVisible(False)
        self.jderobotCommConfigsUI = JdeRobotCommConfigDialog('JdeRobot Communication')
        self.jderobotCommConfigsUI.configChanged.connect(self.configChangedHandler)
        self.configsLayout.addWidget(self.jderobotCommConfigsUI)
        self.jderobotCommConfigsUI.setVisible(True)

        self.rosConfig = None
        self.jdeRobotCommConfig = None

        self.commTypeCombo.addItem('JdeRobot Communication', 'jderobotcomm')
        self.commTypeCombo.addItem('ROS Node', 'ros')
        self.commTypeCombo.currentIndexChanged.connect(self.commTypeComboChanged)

        if config is not None:
            if config.type == ROS:
                self.rosConfig = config
                self.commTypeCombo.setCurrentIndex(1)
                self.loadRosConfigs()
            elif config.type == JDEROBOTCOMM:
                self.jdeRobotCommConfig = config
                self.commTypeCombo.setCurrentIndex(0)
                self.loadJdeRobotCommConfigs()
        else:
            self.loadJdeRobotCommConfigs()
コード例 #34
0
 def createFormGroupBox(self):
     self.formGroupBox = QGroupBox("Entrée")
     simple = QCheckBox("Simplifier (pas de lignes intermédiaires)")  # bool à basculer
     simple.clicked.connect(self._simple)
     self.expression = QLineEdit(str(self.tableau.expr))
     layout = QFormLayout()
     layout.addRow(QLabel("(fraction rationnelle):"), self.expression)
     valid = QPushButton("Valider")
     valid.clicked.connect(self._createTableau)
     layout.addWidget(valid)
     layout.addWidget(simple)
     self.formGroupBox.setLayout(layout)
コード例 #35
0
    def _add_note(self, index):
        current_bookmark = self._manager.get_bookmark_for_index(index)

        dialog = QDialog(self)
        dialog.setWindowTitle(translations.TR_ADD_BOOKMARK_NOTE_TITLE)
        layout = QFormLayout(dialog)
        note_edit = QLineEdit()
        note_edit.setMinimumWidth(300)
        note_edit.setText(current_bookmark.note)
        button_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addRow(translations.TR_ADD_BOOKMARK_NOTE_LABEL, note_edit)
        layout.addWidget(button_box)

        button_box.accepted.connect(dialog.accept)
        button_box.rejected.connect(dialog.reject)

        if dialog.exec_() == QDialog.Accepted:
            self._manager.update_note(current_bookmark, note_edit.text())
コード例 #36
0
ファイル: rosconfigdialog.py プロジェクト: Diegojnb/JdeRobot
    def __init__(self, name):
        super(QDialog, self).__init__()
        self.setWindowTitle(name)
        self.tabWidget = None

        self.config = None
        self.packageTab = None
        self.topicsTab = None

        self.tabWidget = QTabWidget()
        mainLayout = QFormLayout()
        mainLayout.addWidget(self.tabWidget)
        self.packageTab = PackageTab()
        self.packageTab.configChanged.connect(self.configChangedHandler)
        self.tabWidget.addTab(self.packageTab, 'Package')
        self.topicsTab = TopicsTab()
        self.topicsTab.configChanged.connect(self.configChangedHandler)
        self.tabWidget.addTab(self.topicsTab, 'Topics')
        self.resize(700, 100)
        self.setLayout(mainLayout)
コード例 #37
0
ファイル: dockWidget.py プロジェクト: amylittleyang/OtraCAD
    def actionCreate_toeholdTriggeredSlot(self):
        """
        prepare dockWidget for create toehold command:
        create checkbox3p, checkbox5p,buttonBox;
        apply layout;
        """

        if not self.isHidden():
            self.hide()
        else:
            self.setWindowTitle("Create Toehold")
            self.checkBox_3p = QCheckBox("create 3-prime toehold   ")
            self.checkBox_3p.stateChanged.connect(lambda: self.checkBoxStateChangedSlot(self.checkBox_3p))
            self.checkBox_5p = QCheckBox("create 5-prime toehold   ")
            self.checkBox_5p.stateChanged.connect(lambda: self.checkBoxStateChangedSlot(self.checkBox_5p))
            self.checkBox_3p.setCheckable(False)
            self.checkBox_5p.setCheckable(False)
            # self.checkBox_3p.setStyleSheet("background-color:#ddd")
            # self.checkBox_5p.setStyleSheet("background-color:#ddd")

            self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
            self.buttonBox.accepted.connect(self.buttonBoxAcceptedSlot)
            self.buttonBox.rejected.connect(self.buttonBoxRejectedSlot)
            groupBox = QGroupBox()

            layout = QFormLayout()
            layout.addWidget(self.checkBox_3p)
            layout.addWidget(self.checkBox_5p)
            groupBox.setLayout(layout)

            dockWidgetContents = self.widget()
            QWidget().setLayout(dockWidgetContents.layout())
            newLayout = QVBoxLayout()
            newLayout.addWidget(groupBox)
            newLayout.addWidget(self.buttonBox)
            dockWidgetContents.setLayout(newLayout)
            self.can_update = True
            self.show()
            # update appearance of checkboxes based on state of active domain
            self.updateCheckBoxState()
コード例 #38
0
ファイル: spectrum.py プロジェクト: gpiantoni/phypno
    def create_config(self):

        box0 = QGroupBox('Spectrum')

        for k in self.value:
            self.index[k] = FormFloat()
        self.index['log'] = FormBool('Log-transform')

        form_layout = QFormLayout()
        form_layout.addRow('Min X', self.index['x_min'])
        form_layout.addRow('Max X', self.index['x_max'])
        form_layout.addRow('Ticks on X-axis', self.index['x_tick'])
        form_layout.addRow('Min Y', self.index['y_min'])
        form_layout.addRow('Max Y', self.index['y_max'])
        form_layout.addRow('Ticks on Y-axis', self.index['y_tick'])

        form_layout.addWidget(self.index['log'])
        box0.setLayout(form_layout)

        main_layout = QVBoxLayout()
        main_layout.addWidget(box0)
        main_layout.addStretch(1)

        self.setLayout(main_layout)
コード例 #39
0
ファイル: dockWidget.py プロジェクト: amylittleyang/OtraCAD
 def actionResizeToeholdTriggeredSlot(self):
     """
     prepare dock widget for resize toehold panel
     :return:
     """
     if not self.isHidden():
         self.hide()
     elif self.doc == None or self.doc.selectedToehold().__len__() == 0:
         msg = QMessageBox()
         msg.setText("No toehold selected.")
         msg.exec_()
     elif self.doc.selectedToehold().__len__() is not 1:
         msg = QMessageBox()
         msg.setText("Select only one toehold")
         msg.exec_()
     else:
         # prepare dock widget for resize toehold window
         self.can_update = False  # disable createToehold widget update
         self.setWindowTitle("Resize Toehold")
         text_label = QLabel()
         default_label = QLabel()
         nt_label = QLabel()
         default_label.setText("default: 5 nt")
         nt_label.setText("nt")
         text_label.setText("Toehold Length: ")
         groupBox = QGroupBox()
         buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
         buttonBox.accepted.connect(self.resizeToeholdAcceptedSlot)
         buttonBox.rejected.connect(self.resizeToeholdRejectedSlot)
         form = QFormLayout()
         horizontal = QHBoxLayout()
         self.line_edit = QLineEdit()
         list = self.doc.selectedToehold()
         toeholdList = list[0]
         toehold = toeholdList._toehold_list[0]
         self.toehold = toehold
         self.line_edit.setText(str(toehold.length()))
         horizontal.addWidget(text_label)
         horizontal.addWidget(self.line_edit)
         horizontal.addWidget(nt_label)
         groupBox.setLayout(horizontal)
         form.setAlignment(QtCore.Qt.AlignRight)
         form.addWidget(groupBox)
         form.addWidget(default_label)
         form.addWidget(buttonBox)
         dockWidgetContents = self.widget()
         QWidget().setLayout(dockWidgetContents.layout())
         dockWidgetContents.setLayout(form)
         self.show()
コード例 #40
0
ファイル: settings.py プロジェクト: z411/trackma
    def __init__(self, parent, worker, config, configfile):
        QDialog.__init__(self, parent)

        self.worker = worker
        self.config = config
        self.configfile = configfile
        self.setStyleSheet("QGroupBox { font-weight: bold; } ")
        self.setWindowTitle('Settings')
        layout = QGridLayout()

        # Categories
        self.category_list = QListWidget()
        category_media = QListWidgetItem(getIcon('media-playback-start'), 'Media', self.category_list)
        category_sync = QListWidgetItem(getIcon('view-refresh'), 'Sync', self.category_list)
        category_ui = QListWidgetItem(getIcon('window-new'), 'User Interface', self.category_list)
        category_theme = QListWidgetItem(getIcon('applications-graphics'), 'Theme', self.category_list)
        self.category_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.category_list.setCurrentRow(0)
        self.category_list.setMaximumWidth(self.category_list.sizeHintForColumn(0) + 15)
        self.category_list.setFocus()
        self.category_list.currentItemChanged.connect(self.s_switch_page)

        # Media tab
        page_media = QWidget()
        page_media_layout = QVBoxLayout()
        page_media_layout.setAlignment(QtCore.Qt.AlignTop)

        # Group: Media settings
        g_media = QGroupBox('Media settings')
        g_media.setFlat(True)
        g_media_layout = QFormLayout()
        self.tracker_enabled = QCheckBox()
        self.tracker_enabled.toggled.connect(self.tracker_type_change)

        self.tracker_type = QComboBox()
        for (n, label) in utils.available_trackers:
            self.tracker_type.addItem(label, n)
        self.tracker_type.currentIndexChanged.connect(self.tracker_type_change)

        self.tracker_interval = QSpinBox()
        self.tracker_interval.setRange(5, 1000)
        self.tracker_interval.setMaximumWidth(60)
        self.tracker_process = QLineEdit()
        self.tracker_update_wait = QSpinBox()
        self.tracker_update_wait.setRange(0, 1000)
        self.tracker_update_wait.setMaximumWidth(60)
        self.tracker_update_close = QCheckBox()
        self.tracker_update_prompt = QCheckBox()
        self.tracker_not_found_prompt = QCheckBox()

        g_media_layout.addRow('Enable tracker', self.tracker_enabled)
        g_media_layout.addRow('Tracker type', self.tracker_type)
        g_media_layout.addRow('Tracker interval (seconds)', self.tracker_interval)
        g_media_layout.addRow('Process name (regex)', self.tracker_process)
        g_media_layout.addRow('Wait before updating (seconds)', self.tracker_update_wait)
        g_media_layout.addRow('Wait until the player is closed', self.tracker_update_close)
        g_media_layout.addRow('Ask before updating', self.tracker_update_prompt)
        g_media_layout.addRow('Ask to add new shows', self.tracker_not_found_prompt)

        g_media.setLayout(g_media_layout)

        # Group: Plex settings
        g_plex = QGroupBox('Plex Media Server')
        g_plex.setFlat(True)
        self.plex_host = QLineEdit()
        self.plex_port = QLineEdit()
        self.plex_user = QLineEdit()
        self.plex_passw = QLineEdit()
        self.plex_passw.setEchoMode(QLineEdit.Password)
        self.plex_obey_wait = QCheckBox()

        g_plex_layout = QGridLayout()
        g_plex_layout.addWidget(QLabel('Host and Port'),                   0, 0, 1, 1)
        g_plex_layout.addWidget(self.plex_host,                            0, 1, 1, 1)
        g_plex_layout.addWidget(self.plex_port,                            0, 2, 1, 2)
        g_plex_layout.addWidget(QLabel('Use "wait before updating" time'), 1, 0, 1, 1)
        g_plex_layout.addWidget(self.plex_obey_wait,                       1, 2, 1, 1)
        g_plex_layout.addWidget(QLabel('myPlex login (claimed server)'),   2, 0, 1, 1)
        g_plex_layout.addWidget(self.plex_user,                            2, 1, 1, 1)
        g_plex_layout.addWidget(self.plex_passw,                           2, 2, 1, 2)

        g_plex.setLayout(g_plex_layout)

        # Group: Library
        g_playnext = QGroupBox('Library')
        g_playnext.setFlat(True)
        self.player = QLineEdit()
        self.player_browse = QPushButton('Browse...')
        self.player_browse.clicked.connect(self.s_player_browse)
        lbl_searchdirs = QLabel('Media directories')
        lbl_searchdirs.setAlignment(QtCore.Qt.AlignTop)
        self.searchdirs = QListWidget()
        self.searchdirs_add = QPushButton('Add...')
        self.searchdirs_add.clicked.connect(self.s_searchdirs_add)
        self.searchdirs_remove = QPushButton('Remove')
        self.searchdirs_remove.clicked.connect(self.s_searchdirs_remove)
        self.searchdirs_buttons = QVBoxLayout()
        self.searchdirs_buttons.setAlignment(QtCore.Qt.AlignTop)
        self.searchdirs_buttons.addWidget(self.searchdirs_add)
        self.searchdirs_buttons.addWidget(self.searchdirs_remove)
        self.searchdirs_buttons.addWidget(QSplitter())
        self.library_autoscan = QCheckBox()
        self.scan_whole_list = QCheckBox()
        self.library_full_path = QCheckBox()


        g_playnext_layout = QGridLayout()
        g_playnext_layout.addWidget(QLabel('Player'),                    0, 0, 1, 1)
        g_playnext_layout.addWidget(self.player,                         0, 1, 1, 1)
        g_playnext_layout.addWidget(self.player_browse,                  0, 2, 1, 1)
        g_playnext_layout.addWidget(lbl_searchdirs,                      1, 0, 1, 1)
        g_playnext_layout.addWidget(self.searchdirs,                     1, 1, 1, 1)
        g_playnext_layout.addLayout(self.searchdirs_buttons,             1, 2, 1, 1)
        g_playnext_layout.addWidget(QLabel('Rescan Library at startup'), 2, 0, 1, 2)
        g_playnext_layout.addWidget(self.library_autoscan,               2, 2, 1, 1)
        g_playnext_layout.addWidget(QLabel('Scan through whole list'),   3, 0, 1, 2)
        g_playnext_layout.addWidget(self.scan_whole_list,                3, 2, 1, 1)
        g_playnext_layout.addWidget(QLabel('Take subdirectory name into account'), 4, 0, 1, 2)
        g_playnext_layout.addWidget(self.library_full_path,              4, 2, 1, 1)

        g_playnext.setLayout(g_playnext_layout)

        # Media form
        page_media_layout.addWidget(g_media)
        page_media_layout.addWidget(g_plex)
        page_media_layout.addWidget(g_playnext)
        page_media.setLayout(page_media_layout)

        # Sync tab
        page_sync = QWidget()
        page_sync_layout = QVBoxLayout()
        page_sync_layout.setAlignment(QtCore.Qt.AlignTop)

        # Group: Autoretrieve
        g_autoretrieve = QGroupBox('Autoretrieve')
        g_autoretrieve.setFlat(True)
        self.autoretrieve_off = QRadioButton('Disabled')
        self.autoretrieve_always = QRadioButton('Always at start')
        self.autoretrieve_days = QRadioButton('After n days')
        self.autoretrieve_days.toggled.connect(self.s_autoretrieve_days)
        self.autoretrieve_days_n = QSpinBox()
        self.autoretrieve_days_n.setRange(1, 100)
        g_autoretrieve_layout = QGridLayout()
        g_autoretrieve_layout.setColumnStretch(0, 1)
        g_autoretrieve_layout.addWidget(self.autoretrieve_off,    0, 0, 1, 1)
        g_autoretrieve_layout.addWidget(self.autoretrieve_always, 1, 0, 1, 1)
        g_autoretrieve_layout.addWidget(self.autoretrieve_days,   2, 0, 1, 1)
        g_autoretrieve_layout.addWidget(self.autoretrieve_days_n, 2, 1, 1, 1)
        g_autoretrieve.setLayout(g_autoretrieve_layout)

        # Group: Autosend
        g_autosend = QGroupBox('Autosend')
        g_autosend.setFlat(True)
        self.autosend_off = QRadioButton('Disabled')
        self.autosend_always = QRadioButton('Immediately after every change')
        self.autosend_minutes = QRadioButton('After n minutes')
        self.autosend_minutes.toggled.connect(self.s_autosend_minutes)
        self.autosend_minutes_n = QSpinBox()
        self.autosend_minutes_n.setRange(1, 1000)
        self.autosend_size = QRadioButton('After the queue reaches n items')
        self.autosend_size.toggled.connect(self.s_autosend_size)
        self.autosend_size_n = QSpinBox()
        self.autosend_size_n.setRange(2, 20)
        self.autosend_at_exit = QCheckBox('At exit')
        g_autosend_layout = QGridLayout()
        g_autosend_layout.setColumnStretch(0, 1)
        g_autosend_layout.addWidget(self.autosend_off,      0, 0, 1, 1)
        g_autosend_layout.addWidget(self.autosend_always,   1, 0, 1, 1)
        g_autosend_layout.addWidget(self.autosend_minutes,    2, 0, 1, 1)
        g_autosend_layout.addWidget(self.autosend_minutes_n,  2, 1, 1, 1)
        g_autosend_layout.addWidget(self.autosend_size,     3, 0, 1, 1)
        g_autosend_layout.addWidget(self.autosend_size_n,   3, 1, 1, 1)
        g_autosend_layout.addWidget(self.autosend_at_exit,  4, 0, 1, 1)
        g_autosend.setLayout(g_autosend_layout)

        # Group: Extra
        g_extra = QGroupBox('Additional options')
        g_extra.setFlat(True)
        self.auto_status_change = QCheckBox('Change status automatically')
        self.auto_status_change.toggled.connect(self.s_auto_status_change)
        self.auto_status_change_if_scored = QCheckBox('Change status automatically only if scored')
        self.auto_date_change = QCheckBox('Change start and finish dates automatically')
        g_extra_layout = QVBoxLayout()
        g_extra_layout.addWidget(self.auto_status_change)
        g_extra_layout.addWidget(self.auto_status_change_if_scored)
        g_extra_layout.addWidget(self.auto_date_change)
        g_extra.setLayout(g_extra_layout)

        # Sync layout
        page_sync_layout.addWidget(g_autoretrieve)
        page_sync_layout.addWidget(g_autosend)
        page_sync_layout.addWidget(g_extra)
        page_sync.setLayout(page_sync_layout)

        # UI tab
        page_ui = QWidget()
        page_ui_layout = QFormLayout()
        page_ui_layout.setAlignment(QtCore.Qt.AlignTop)

        # Group: Icon
        g_icon = QGroupBox('Notification Icon')
        g_icon.setFlat(True)
        self.tray_icon = QCheckBox('Show tray icon')
        self.tray_icon.toggled.connect(self.s_tray_icon)
        self.close_to_tray = QCheckBox('Close to tray')
        self.start_in_tray = QCheckBox('Start minimized to tray')
        self.tray_api_icon = QCheckBox('Use API icon as tray icon')
        self.notifications = QCheckBox('Show notification when tracker detects new media')
        g_icon_layout = QVBoxLayout()
        g_icon_layout.addWidget(self.tray_icon)
        g_icon_layout.addWidget(self.close_to_tray)
        g_icon_layout.addWidget(self.start_in_tray)
        g_icon_layout.addWidget(self.tray_api_icon)
        g_icon_layout.addWidget(self.notifications)
        g_icon.setLayout(g_icon_layout)

        # Group: Window
        g_window = QGroupBox('Window')
        g_window.setFlat(True)
        self.remember_geometry = QCheckBox('Remember window size and position')
        self.remember_columns = QCheckBox('Remember column layouts and widths')
        self.columns_per_api = QCheckBox('Use different visible columns per API')
        g_window_layout = QVBoxLayout()
        g_window_layout.addWidget(self.remember_geometry)
        g_window_layout.addWidget(self.remember_columns)
        g_window_layout.addWidget(self.columns_per_api)
        g_window.setLayout(g_window_layout)

        # Group: Lists
        g_lists = QGroupBox('Lists')
        g_lists.setFlat(True)
        self.filter_bar_position = QComboBox()
        filter_bar_positions = [(FilterBar.PositionHidden,     'Hidden'),
                                (FilterBar.PositionAboveLists, 'Above lists'),
                                (FilterBar.PositionBelowLists, 'Below lists')]
        for (n, label) in filter_bar_positions:
            self.filter_bar_position.addItem(label, n)
        self.inline_edit = QCheckBox('Enable in-line editing')
        g_lists_layout = QFormLayout()
        g_lists_layout.addRow('Filter bar position:', self.filter_bar_position)
        g_lists_layout.addRow(self.inline_edit)
        g_lists.setLayout(g_lists_layout)

        # UI layout
        page_ui_layout.addWidget(g_icon)
        page_ui_layout.addWidget(g_window)
        page_ui_layout.addWidget(g_lists)
        page_ui.setLayout(page_ui_layout)

        # Theming tab
        page_theme = QWidget()
        page_theme_layout = QFormLayout()
        page_theme_layout.setAlignment(QtCore.Qt.AlignTop)

        # Group: Episode Bar
        g_ep_bar = QGroupBox('Episode Bar')
        g_ep_bar.setFlat(True)
        self.ep_bar_style = QComboBox()
        ep_bar_styles = [(ShowsTableDelegate.BarStyleBasic,  'Basic'),
                         (ShowsTableDelegate.BarStyle04,     'Trackma'),
                         (ShowsTableDelegate.BarStyleHybrid, 'Hybrid')]
        for (n, label) in ep_bar_styles:
            self.ep_bar_style.addItem(label, n)
        self.ep_bar_style.currentIndexChanged.connect(self.s_ep_bar_style)
        self.ep_bar_text = QCheckBox('Show text label')
        g_ep_bar_layout = QFormLayout()
        g_ep_bar_layout.addRow('Style:', self.ep_bar_style)
        g_ep_bar_layout.addRow(self.ep_bar_text)
        g_ep_bar.setLayout(g_ep_bar_layout)

        # Group: Colour scheme
        g_scheme = QGroupBox('Color Scheme')
        g_scheme.setFlat(True)
        col_tabs = [('rows',     '&Row highlights'),
                    ('progress', '&Progress widget')]
        self.colors = {}
        self.colors['rows'] = [('is_playing',  'Playing'),
                               ('is_queued',   'Queued'),
                               ('new_episode', 'New Episode'),
                               ('is_airing',   'Airing'),
                               ('not_aired',   'Unaired')]
        self.colors['progress'] = [('progress_bg',       'Background'),
                                   ('progress_fg',       'Watched bar'),
                                   ('progress_sub_bg',   'Aired episodes'),
                                   ('progress_sub_fg',   'Stored episodes'),
                                   ('progress_complete', 'Complete')]
        self.color_buttons = []
        self.syscolor_buttons = []
        g_scheme_layout = QGridLayout()
        tw_scheme = QTabWidget()
        for (key, tab_title) in col_tabs:
            page = QFrame()
            page_layout = QGridLayout()
            col = 0
            # Generate widgets from the keys and values
            for (key, label) in self.colors[key]:
                self.color_buttons.append(QPushButton())
                # self.color_buttons[-1].setStyleSheet('background-color: ' + getColor(self.config['colors'][key]).name())
                self.color_buttons[-1].setFocusPolicy(QtCore.Qt.NoFocus)
                self.color_buttons[-1].clicked.connect(self.s_color_picker(key, False))
                self.syscolor_buttons.append(QPushButton('System Colors'))
                self.syscolor_buttons[-1].clicked.connect(self.s_color_picker(key, True))
                page_layout.addWidget(QLabel(label),             col, 0, 1, 1)
                page_layout.addWidget(self.color_buttons[-1],    col, 1, 1, 1)
                page_layout.addWidget(self.syscolor_buttons[-1], col, 2, 1, 1)
                col += 1
            page.setLayout(page_layout)
            tw_scheme.addTab(page, tab_title)
        g_scheme_layout.addWidget(tw_scheme)
        g_scheme.setLayout(g_scheme_layout)

        # UI layout
        page_theme_layout.addWidget(g_ep_bar)
        page_theme_layout.addWidget(g_scheme)
        page_theme.setLayout(page_theme_layout)

        # Content
        self.contents = QStackedWidget()
        self.contents.addWidget(page_media)
        self.contents.addWidget(page_sync)
        self.contents.addWidget(page_ui)
        self.contents.addWidget(page_theme)
        if pyqt_version is not 5:
            self.contents.layout().setMargin(0)

        # Bottom buttons
        bottombox = QDialogButtonBox(
            QDialogButtonBox.Ok
            | QDialogButtonBox.Apply
            | QDialogButtonBox.Cancel
        )
        bottombox.accepted.connect(self.s_save)
        bottombox.button(QDialogButtonBox.Apply).clicked.connect(self._save)
        bottombox.rejected.connect(self.reject)

        # Main layout finish
        layout.addWidget(self.category_list,  0, 0, 1, 1)
        layout.addWidget(self.contents,       0, 1, 1, 1)
        layout.addWidget(bottombox,           1, 0, 1, 2)
        layout.setColumnStretch(1, 1)

        self._load()
        self.update_colors()

        self.setLayout(layout)
コード例 #41
0
    def createShow(self):
        self.show_group = QGroupBox()
        self.show_group.setTitle(self.name)

        self.show_open_edit = QLineEdit()
        self.show_open_edit.setDisabled(True)
        self.show_high_edit = QLineEdit()
        self.show_high_edit.setDisabled(True)
        self.show_low_edit = QLineEdit()
        self.show_low_edit.setDisabled(True)
        self.show_close_edit = QLineEdit()
        self.show_close_edit.setDisabled(True)
        layout = QFormLayout()
        layout.addWidget(QLabel('open'))
        layout.addWidget(self.show_open_edit)
        layout.addWidget(QLabel('high'))
        layout.addWidget(self.show_high_edit)
        layout.addWidget(QLabel('low'))
        layout.addWidget(self.show_low_edit)
        layout.addWidget(QLabel('close'))
        layout.addWidget(self.show_close_edit)
        self.show_group.setLayout(layout)
コード例 #42
0
	def init_right_panel(self):

		#def title_def(title):
		#	title_lbl = QLabel(title)
		#	f = QFont()
		#	f.setPixelSize(16)
		#	title_lbl.setFont(f)
		#	return title_lbl

		# App
		application = QTabWidget()
		self.application_index = self.right_panel.addWidget(application)
		application_general = QWidget()
		application.addTab(application_general, 'General')
		application.setTabEnabled(0, False)

		# App / Monitor
		app_monitor_page = QScrollArea()
		app_monitor_page.setBackgroundRole(QPalette.Base)
		app_monitor_dummy = QWidget()
		app_monitor_page.setWidgetResizable(True)
		app_monitor_page.setWidget(app_monitor_dummy)
		application.addTab(app_monitor_page, 'Monitoring')
		application.setCurrentIndex(1)
		app_monitor_m_l = QVBoxLayout(app_monitor_dummy)
		# App / Monitor / misc
		app_monitor_misc_group = QGroupBox('General *', self)
		app_monitor_m_l.addWidget(app_monitor_misc_group)
		app_monitor_misc_m_l = QFormLayout(app_monitor_misc_group)
		monitor_info = QLabel('Directory monitoring will monitor the specified directories for any'+
						' gallery events. For example if you delete a gallery source in one of your'+
						' monitored directories the application will inform you about it, and ask if'+
						' you want to delete the gallery from the application as well.')
		monitor_info.setWordWrap(True)
		app_monitor_misc_m_l.addRow(monitor_info)
		self.enable_monitor = QCheckBox('Enable directory monitoring')
		app_monitor_misc_m_l.addRow(self.enable_monitor)
		self.look_new_gallery_startup = QGroupBox('Scan for new galleries on startup', self)
		app_monitor_misc_m_l.addRow(self.look_new_gallery_startup)
		self.look_new_gallery_startup.setCheckable(True)
		look_new_gallery_startup_m_l = QVBoxLayout(self.look_new_gallery_startup)
		self.auto_add_new_galleries = QCheckBox('Automatically add found galleries')
		look_new_gallery_startup_m_l.addWidget(self.auto_add_new_galleries)

		# App / Monitor / folders
		app_monitor_group = QGroupBox('Directories *', self)
		app_monitor_m_l.addWidget(app_monitor_group, 1)
		app_monitor_folders_m_l = QVBoxLayout(app_monitor_group)
		app_monitor_folders_add = QPushButton('+')
		app_monitor_folders_add.clicked.connect(self.add_folder_monitor)
		app_monitor_folders_add.setMaximumWidth(20)
		app_monitor_folders_add.setMaximumHeight(20)
		app_monitor_folders_m_l.addWidget(app_monitor_folders_add, 0, Qt.AlignRight)
		self.folders_layout = QFormLayout()
		app_monitor_folders_m_l.addLayout(self.folders_layout)

		# Web
		web = QTabWidget()
		self.web_index = self.right_panel.addWidget(web)
		web_general_page = QScrollArea()
		web_general_page.setBackgroundRole(QPalette.Base)
		web_general_page.setWidgetResizable(True)
		web.addTab(web_general_page, 'General')
		web_general_dummy = QWidget()
		web_general_page.setWidget(web_general_dummy)
		web_general_m_l = QVBoxLayout(web_general_dummy)
		metadata_fetcher_group = QGroupBox('Metadata', self)
		web_general_m_l.addWidget(metadata_fetcher_group)
		metadata_fetcher_m_l = QFormLayout(metadata_fetcher_group)
		self.default_ehen_url = QRadioButton('g.e-hentai.org', metadata_fetcher_group)
		self.exhentai_ehen_url = QRadioButton('exhentai.org', metadata_fetcher_group)
		ehen_url_l = QHBoxLayout()
		ehen_url_l.addWidget(self.default_ehen_url)
		ehen_url_l.addWidget(self.exhentai_ehen_url, 1)
		metadata_fetcher_m_l.addRow('Default URL:', ehen_url_l)
		self.continue_a_metadata_fetcher = QCheckBox('Continue from where auto metadata fetcher left off')
		metadata_fetcher_m_l.addRow(self.continue_a_metadata_fetcher)
		self.use_jpn_title = QCheckBox('Use japanese title')
		metadata_fetcher_m_l.addRow(self.use_jpn_title)
		time_offset_info = QLabel('To avoid getting banned, we need to impose a delay between our requests.'+
							' I have made it so you cannot set the delay lower than the recommended (I don\'t'+
							' want you to get banned, anon).\nSpecify the delay between requests in seconds.')
		time_offset_info.setWordWrap(True)
		self.web_time_offset = QSpinBox()
		self.web_time_offset.setMaximumWidth(40)
		self.web_time_offset.setMinimum(4)
		self.web_time_offset.setMaximum(99)
		metadata_fetcher_m_l.addRow(time_offset_info)
		metadata_fetcher_m_l.addRow('Requests delay in', self.web_time_offset)
		replace_metadata_info = QLabel('When fetching for metadata the new metadata will be appended'+
								 ' to the gallery by default. This means that new data will only be set if'+
								 ' the field was empty. There is however a special case for namespace & tags.'+
								 ' We go through all the new namespace & tags to only add those that'+
								 ' do not already exists.\n\nEnabling this option makes it so that a gallery\'s old data'+
								 ' are deleted and replaced with the new data.')
		replace_metadata_info.setWordWrap(True)
		self.replace_metadata = QCheckBox('Replace old metadata with new metadata')
		metadata_fetcher_m_l.addRow(replace_metadata_info)
		metadata_fetcher_m_l.addRow(self.replace_metadata)
		first_hit_info = QLabel('By default, you get to choose which gallery to extract metadata from when'+
						  ' there is more than one gallery found when searching.\n'+
						  'Enabling this option makes it choose the first hit, saving you from moving your mouse.')
		first_hit_info.setWordWrap(True)
		self.always_first_hit = QCheckBox('Always choose first hit')
		metadata_fetcher_m_l.addRow(first_hit_info)
		metadata_fetcher_m_l.addRow(self.always_first_hit)

		# Web / Exhentai
		exhentai_page = QWidget()
		web.addTab(exhentai_page, 'ExHentai')
		ipb_layout = QFormLayout()
		exhentai_page.setLayout(ipb_layout)
		self.ipbid_edit = QLineEdit()
		self.ipbpass_edit = QLineEdit()
		exh_tutorial = QLabel(gui_constants.EXHEN_COOKIE_TUTORIAL)
		exh_tutorial.setTextFormat(Qt.RichText)
		ipb_layout.addRow('IPB Member ID:', self.ipbid_edit)
		ipb_layout.addRow('IPB Pass Hash:', self.ipbpass_edit)
		ipb_layout.addRow(exh_tutorial)

		# Visual
		visual = QTabWidget()
		self.visual_index = self.right_panel.addWidget(visual)
		visual_general_page = QWidget()
		visual.addTab(visual_general_page, 'General')

		grid_view_general_page = QWidget()
		visual.addTab(grid_view_general_page, 'Grid View')
		grid_view_layout = QVBoxLayout()
		grid_view_layout.addWidget(QLabel('Options marked with * requires application restart'),
						   0, Qt.AlignTop)
		grid_view_general_page.setLayout(grid_view_layout)
		# grid view
		# grid view / tooltip
		self.grid_tooltip_group = QGroupBox('Tooltip', grid_view_general_page)
		self.grid_tooltip_group.setCheckable(True)
		grid_view_layout.addWidget(self.grid_tooltip_group, 0, Qt.AlignTop)
		grid_tooltip_layout = QFormLayout()
		self.grid_tooltip_group.setLayout(grid_tooltip_layout)
		grid_tooltip_layout.addRow(QLabel('Control what is'+
									' displayed in the tooltip'))
		grid_tooltips_hlayout = FlowLayout()
		grid_tooltip_layout.addRow(grid_tooltips_hlayout)
		self.visual_grid_tooltip_title = QCheckBox('Title')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_title)
		self.visual_grid_tooltip_author = QCheckBox('Author')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_author)
		self.visual_grid_tooltip_chapters = QCheckBox('Chapters')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_chapters)
		self.visual_grid_tooltip_status = QCheckBox('Status')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_status)
		self.visual_grid_tooltip_type = QCheckBox('Type')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_type)
		self.visual_grid_tooltip_lang = QCheckBox('Language')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_lang)
		self.visual_grid_tooltip_descr = QCheckBox('Description')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_descr)
		self.visual_grid_tooltip_tags = QCheckBox('Tags')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_tags)
		self.visual_grid_tooltip_last_read = QCheckBox('Last read')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_last_read)
		self.visual_grid_tooltip_times_read = QCheckBox('Times read')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_times_read)
		self.visual_grid_tooltip_pub_date = QCheckBox('Publication Date')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_pub_date)
		self.visual_grid_tooltip_date_added = QCheckBox('Date added')
		grid_tooltips_hlayout.addWidget(self.visual_grid_tooltip_date_added)
		# grid view / gallery
		grid_gallery_group = QGroupBox('Gallery', grid_view_general_page)
		grid_view_layout.addWidget(grid_gallery_group, 0, Qt.AlignTop)
		grid_gallery_main_l = QFormLayout()
		grid_gallery_main_l.setFormAlignment(Qt.AlignLeft)
		grid_gallery_group.setLayout(grid_gallery_main_l)
		grid_gallery_display = FlowLayout()
		grid_gallery_main_l.addRow('Display on gallery:', grid_gallery_display)
		self.external_viewer_ico = QCheckBox('External Viewer')
		self.external_viewer_ico.setDisabled(True)
		grid_gallery_display.addWidget(self.external_viewer_ico)
		self.gallery_type_ico = QCheckBox('File Type')
		self.gallery_type_ico.setDisabled(True)
		grid_gallery_display.addWidget(self.gallery_type_ico)
		gallery_text_mode = QWidget()
		grid_gallery_main_l.addRow('Text Mode:', gallery_text_mode)
		gallery_text_mode_l = QHBoxLayout()
		gallery_text_mode.setLayout(gallery_text_mode_l)
		self.gallery_text_elide = QRadioButton('Elide text', gallery_text_mode)
		self.gallery_text_fit = QRadioButton('Fit text', gallery_text_mode)
		gallery_text_mode_l.addWidget(self.gallery_text_elide, 0, Qt.AlignLeft)
		gallery_text_mode_l.addWidget(self.gallery_text_fit, 0, Qt.AlignLeft)
		gallery_text_mode_l.addWidget(Spacer('h'), 1, Qt.AlignLeft)
		gallery_font = QHBoxLayout()
		grid_gallery_main_l.addRow('Font:*', gallery_font)
		self.font_lbl = QLabel()
		self.font_size_lbl = QSpinBox()
		self.font_size_lbl.setMaximum(100)
		self.font_size_lbl.setMinimum(1)
		self.font_size_lbl.setToolTip('Font size in pixels')
		choose_font = QPushButton('Choose font')
		choose_font.clicked.connect(self.choose_font)
		gallery_font.addWidget(self.font_lbl, 0, Qt.AlignLeft)
		gallery_font.addWidget(self.font_size_lbl, 0, Qt.AlignLeft)
		gallery_font.addWidget(choose_font, 0, Qt.AlignLeft)
		gallery_font.addWidget(Spacer('h'), 1, Qt.AlignLeft)
		# grid view / colors
		grid_colors_group = QGroupBox('Colors', grid_view_general_page)
		grid_view_layout.addWidget(grid_colors_group, 1, Qt.AlignTop)
		grid_colors_l = QFormLayout()
		grid_colors_group.setLayout(grid_colors_l)
		def color_lineedit():
			l = QLineEdit()
			l.setPlaceholderText('Hex colors. Eg.: #323232')
			l.setMaximumWidth(200)
			return l
		self.grid_label_color = color_lineedit()
		self.grid_title_color = color_lineedit()
		self.grid_artist_color = color_lineedit()
		grid_colors_l.addRow('Label color:', self.grid_label_color)
		grid_colors_l.addRow('Title color:', self.grid_title_color)
		grid_colors_l.addRow('Artist color:', self.grid_artist_color)

		style_page = QWidget()
		visual.addTab(style_page, 'Style')
		visual.setTabEnabled(0, False)
		visual.setTabEnabled(2, False)
		visual.setCurrentIndex(1)

		# Advanced
		advanced = QTabWidget()
		self.advanced_index = self.right_panel.addWidget(advanced)
		advanced_misc = QWidget()
		advanced.addTab(advanced_misc, 'Misc')
		advanced_misc_main_layout = QVBoxLayout()
		advanced_misc.setLayout(advanced_misc_main_layout)
		misc_controls_layout = QFormLayout()
		misc_controls_layout.addWidget(QLabel('Options marked with * requires application restart'))
		advanced_misc_main_layout.addLayout(misc_controls_layout)
		# Advanced / Misc / Grid View
		misc_gridview = QGroupBox('Grid View')
		misc_controls_layout.addWidget(misc_gridview)
		misc_gridview_layout = QFormLayout()
		misc_gridview.setLayout(misc_gridview_layout)
		# Advanced / Misc / Grid View / scroll speed
		scroll_speed_spin_box = QSpinBox()
		scroll_speed_spin_box.setFixedWidth(60)
		scroll_speed_spin_box.setToolTip('Control the speed when scrolling in'+
								   ' grid view. DEFAULT: 7')
		scroll_speed_spin_box.setValue(self.scroll_speed)
		def scroll_speed(v): self.scroll_speed = v
		scroll_speed_spin_box.valueChanged[int].connect(scroll_speed)
		misc_gridview_layout.addRow('Scroll speed:', scroll_speed_spin_box)
		# Advanced / Misc / Grid View / cache size
		cache_size_spin_box = QSpinBox()
		cache_size_spin_box.setFixedWidth(120)
		cache_size_spin_box.setMaximum(999999999)
		cache_size_spin_box.setToolTip('This will greatly improve the grid view.' +
								 ' Increase the value if you experience lag when scrolling'+
								 ' through galleries. DEFAULT: 200 MiB')
		def cache_size(c): self.cache_size = (self.cache_size[0], c)
		cache_size_spin_box.setValue(self.cache_size[1])
		cache_size_spin_box.valueChanged[int].connect(cache_size)
		misc_gridview_layout.addRow('Cache Size (MiB):', cache_size_spin_box)		
		# Advanced / Misc / Regex
		misc_search = QGroupBox('Search')
		misc_controls_layout.addWidget(misc_search)
		misc_search_layout = QFormLayout()
		misc_search.setLayout(misc_search_layout)
		search_allow_regex_l = QHBoxLayout()
		self.search_allow_regex = QCheckBox()
		self.search_allow_regex.setChecked(gui_constants.ALLOW_SEARCH_REGEX)
		self.search_allow_regex.adjustSize()
		self.search_allow_regex.setToolTip('A regex cheatsheet is located at About->Regex Cheatsheet')
		search_allow_regex_l.addWidget(self.search_allow_regex)
		search_allow_regex_l.addWidget(QLabel('A regex cheatsheet is located at About->Regex Cheatsheet'))
		search_allow_regex_l.addWidget(Spacer('h'))
		misc_search_layout.addRow('Regex:', search_allow_regex_l)
		# Advanced / Misc / Regex / autocomplete
		self.search_autocomplete = QCheckBox('*')
		self.search_autocomplete.setChecked(gui_constants.SEARCH_AUTOCOMPLETE)
		self.search_autocomplete.setToolTip('Turn autocomplete on/off')
		misc_search_layout.addRow('Autocomplete', self.search_autocomplete)
		# Advanced / Misc / Regex / search behaviour
		self.search_every_keystroke = QRadioButton('Search on every keystroke *', misc_search)
		misc_search_layout.addRow(self.search_every_keystroke)
		self.search_on_enter = QRadioButton('Search on enter-key *', misc_search)
		misc_search_layout.addRow(self.search_on_enter)
		# Advanced / Misc / External Viewer
		misc_external_viewer = QGroupBox('External Viewer')
		misc_controls_layout.addWidget(misc_external_viewer)
		misc_external_viewer_l = QFormLayout()
		misc_external_viewer.setLayout(misc_external_viewer_l)
		misc_external_viewer_l.addRow(QLabel(gui_constants.SUPPORTED_EXTERNAL_VIEWER_LBL))
		self.external_viewer_path = PathLineEdit(misc_external_viewer, False)
		self.external_viewer_path.setPlaceholderText('Right/Left-click to open folder explorer.'+
							  ' Leave empty to use default viewer')
		self.external_viewer_path.setToolTip('Right/Left-click to open folder explorer.'+
							  ' Leave empty to use default viewer')
		self.external_viewer_path.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
		misc_external_viewer_l.addRow('Path:', self.external_viewer_path)


		# Advanced / Database
		advanced_db_page = QWidget()
		advanced.addTab(advanced_db_page, 'Database')
		advanced.setTabEnabled(1, False)


		# About
		about = QTabWidget()
		self.about_index = self.right_panel.addWidget(about)
		about_happypanda_page = QWidget()
		about_troubleshoot_page = QWidget()
		about.addTab(about_happypanda_page, 'About Happypanda')
		about_layout = QVBoxLayout()
		about_happypanda_page.setLayout(about_layout)
		info_lbl = QLabel('<b>Author:</b> <a href=\'https://github.com/Pewpews\'>'+
					'Pewpews</a><br/>'+
					'Chat: <a href=\'https://gitter.im/Pewpews/happypanda\'>'+
					'Gitter chat</a><br/>'+
					'Email: [email protected]<br/>'+
					'<b>Current version {}</b><br/>'.format(gui_constants.vs)+
					'Happypanda was created using:<br/>'+
					'- Python 3.4<br/>'+
					'- The Qt5 Framework')
		info_lbl.setOpenExternalLinks(True)
		about_layout.addWidget(info_lbl, 0, Qt.AlignTop)
		gpl_lbl = QLabel(gui_constants.GPL)
		gpl_lbl.setOpenExternalLinks(True)
		gpl_lbl.setWordWrap(True)
		about_layout.addWidget(gpl_lbl, 0, Qt.AlignTop)
		about_layout.addWidget(Spacer('v'))
		# About / Tags
		about_tags_page = QWidget()
		about.addTab(about_tags_page, 'Tags')
		about.setTabEnabled(1, False)
		# list of tags/namespaces here

		# About / Troubleshooting
		about.addTab(about_troubleshoot_page, 'Troubleshooting Guide')
		troubleshoot_layout = QVBoxLayout()
		about_troubleshoot_page.setLayout(troubleshoot_layout)
		guide_lbl = QLabel(gui_constants.TROUBLE_GUIDE)
		guide_lbl.setTextFormat(Qt.RichText)
		guide_lbl.setOpenExternalLinks(True)
		troubleshoot_layout.addWidget(guide_lbl, 0, Qt.AlignTop)
		troubleshoot_layout.addWidget(Spacer('v'))
		# About / Regex Cheatsheet
		about_s_regex = QGroupBox('Regex')
		about.addTab(about_s_regex, 'Regex Cheatsheet')
		about_s_regex_l = QFormLayout()
		about_s_regex.setLayout(about_s_regex_l)
		about_s_regex_l.addRow('\\\\\\\\', QLabel('Match literally \\'))
		about_s_regex_l.addRow('.', QLabel('Match any single character'))
		about_s_regex_l.addRow('^', QLabel('Start of string'))
		about_s_regex_l.addRow('$', QLabel('End of string'))
		about_s_regex_l.addRow('\\d', QLabel('Match any decimal digit'))
		about_s_regex_l.addRow('\\D', QLabel('Match any non-digit character'))
		about_s_regex_l.addRow('\\s', QLabel('Match any whitespace character'))
		about_s_regex_l.addRow('\\S', QLabel('Match any non-whitespace character'))
		about_s_regex_l.addRow('\\w', QLabel('Match any alphanumeric character'))
		about_s_regex_l.addRow('\\W', QLabel('Match any non-alphanumeric character'))
		about_s_regex_l.addRow('*', QLabel('Repeat previous character zero or more times'))
		about_s_regex_l.addRow('+', QLabel('Repeat previous character one or more times'))
		about_s_regex_l.addRow('?', QLabel('Repeat previous character one or zero times'))
		about_s_regex_l.addRow('{m, n}', QLabel('Repeat previous character atleast <i>m</i> times but no more than <i>n</i> times'))
		about_s_regex_l.addRow('(...)', QLabel('Match everything enclosed'))
		about_s_regex_l.addRow('(a|b)', QLabel('Match either a or b'))
		about_s_regex_l.addRow('[abc]', QLabel('Match a single character of: a, b or c'))
		about_s_regex_l.addRow('[^abc]', QLabel('Match a character except: a, b or c'))
		about_s_regex_l.addRow('[a-z]', QLabel('Match a character in the range'))
		about_s_regex_l.addRow('[^a-z]', QLabel('Match a character not in the range'))
		# About / Search tutorial
		about_search_scroll = QScrollArea()
		about_search_scroll.setBackgroundRole(QPalette.Base)
		about_search_scroll.setWidgetResizable(True)
		about_search_tut = QWidget()
		about.addTab(about_search_scroll, 'Search Guide')
		about_search_tut_l = QVBoxLayout()
		about_search_tut.setLayout(about_search_tut_l)
		# General
		about_search_general = QGroupBox('General')
		about_search_tut_l.addWidget(about_search_general)
		about_search_general_l = QFormLayout()
		about_search_general.setLayout(about_search_general_l)
		about_search_general_l.addRow(QLabel(gui_constants.SEARCH_TUTORIAL_GENERAL))
		# Title & Author
		about_search_tit_aut = QGroupBox('Title and Author')
		about_search_tut_l.addWidget(about_search_tit_aut)
		about_search_tit_l = QFormLayout()
		about_search_tit_aut.setLayout(about_search_tit_l)
		about_search_tit_l.addRow(QLabel(gui_constants.SEARCH_TUTORIAL_TIT_AUT))
		# Namespace & Tags
		about_search_tags = QGroupBox('Namespace and Tags')
		about_search_tut_l.addWidget(about_search_tags)
		about_search_tags_l = QFormLayout()
		about_search_tags.setLayout(about_search_tags_l)
		about_search_tags_l.addRow(QLabel(gui_constants.SEARCH_TUTORIAL_TAGS))
		about_search_scroll.setWidget(about_search_tut)
コード例 #43
0
ファイル: Adddlg.py プロジェクト: keyvin/docnotes
class AddDlg(QtWidgets.QDialog):
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.success = False
        self.url = ''
        self.target = ''
        self.makeWindow()
        #self.setWindowModality(QtCore.Qt.WindowModal)


    def makeWindow(self):
        self.layout = QFormLayout()
        self.setLayout(self.layout)
        self.layout.addWidget(QLabel("URL"))
        self.url_entry = QLineEdit()
        self.layout.addWidget(self.url_entry)
        self.layout.addWidget(QLabel("Destination"))
        self.destination_entry = QLineEdit()
        self.layout.addWidget(self.destination_entry)
        self.add_button = QPushButton("Add")
        self.add_button.clicked.connect(self.addClick)
        self.layout.addWidget(self.add_button)
        self.cancel_button = QPushButton("Cancel")
        self.layout.addWidget(self.cancel_button)
        self.cancel_button.clicked.connect(self.cancelClick)
        pass

    def addClick(self):
        #Check that destination is writeable
        #check URL exists
#        print("here")
        self.url = self.url_entry.text()
        self.target = self.destination_entry.text()

        self.close()
        if __name__=="__main__":
            sys.exit(0)

    def cancelClick(self):
        print("Cancel")
        pass
コード例 #44
0
ファイル: dockWidget.py プロジェクト: amylittleyang/OtraCAD
    def actionRipOffTriggeredSlot(self):

        # check if can apply operation
        if self.doc is None:
            return
        domain = self.doc.activeDomain()
        self.activeDomain = domain
        if domain is None:
            msg = QMessageBox()
            msg.setText("Must select one strand")
            msg.exec_()
            return
        oligo = domain.oligo()
        if oligo.isLoop():
            msg = QMessageBox()
            msg.setText("Can't rip off loop strand")
            msg.exec_()
            return
        if not oligo.hasToehold():
            msg = QMessageBox()
            msg.setText("Strand does not have overhang toehold")
            msg.exec_()
            return
        if self.isVisible():
            self.RipOffRejectedSlot()
            self.hide()
            return
        else:
            self.show()
        # prepare dock widget for rip off panel
        self.can_update = False  # disable createToehold widget update
        self.setWindowTitle("Rip Off Strand")
        text0 = QLabel()
        text0.setText("Selected Strand:")
        text1 = QLabel()
        d5p = oligo.strand5p()
        d3p = oligo.domain3p()
        dcurr = d5p
        s = d5p._name
        dcurr = dcurr.connection3p()
        while dcurr != None:
            s = s + "_" + dcurr._name
            dcurr = dcurr.connection3p()
        if d5p.toehold5p() is not None:
            t_list_5 = d5p.toehold5p()._toehold_list
            for t in t_list_5:
                s = t._name + "_" + s
        if d3p.toehold3p() is not None:
            t_list_3 = d3p.toehold3p()._toehold_list
            for t in t_list_3:
                s = s + "_" + t._name
        text1.setText("strand %s on helix %d   " % (s, d5p._vhNum))
        text2 = QLabel()
        text2.setText("length: %s" % oligo._length)
        text3 = QLabel()
        text3.setText("Complement Strand: (5' to 3')  ")
        text4 = QLabel()
        d3p = oligo.domain3p()
        s = d3p._name
        dcurr = d3p.connection5p()
        while dcurr != None:
            s = s + "_" + dcurr._name
            dcurr = dcurr.connection5p()
        if d5p.toehold5p() is not None:
            t_list_5 = d5p.toehold5p()._toehold_list
            for t in t_list_5:
                s = s + "_" + t._name
        if d3p.toehold3p() is not None:
            t_list_3 = d3p.toehold3p()._toehold_list
            for t in t_list_3:
                s = t._name + "_" + s

        text4.setText("%s" % s)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.RipOffAcceptedSlot)
        buttonBox.rejected.connect(self.RipOffRejectedSlot)

        form = QFormLayout()
        form.addWidget(text0)
        form.addWidget(text1)
        form.addWidget(text2)
        form.addWidget(text3)
        form.addWidget(text4)
        form.addWidget(buttonBox)
        dockWidgetContents = self.widget()
        QWidget().setLayout(dockWidgetContents.layout())
        dockWidgetContents.setLayout(form)
        self.show()
        # create previewRipOffCommand to preview operation
        domain.oligo().previewRipOff()