當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.setToolTipDuration方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setToolTipDuration方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setToolTipDuration方法的具體用法?Python QLineEdit.setToolTipDuration怎麽用?Python QLineEdit.setToolTipDuration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.setToolTipDuration方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: manage_properties

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTipDuration [as 別名]
    def manage_properties(self):
        self.update()
        self.setWindowTitle('Properties:')
        layout = QGridLayout()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.button(QDialogButtonBox.Ok).setDefault(True)

        for idx, prop in enumerate(sorted(self.flume_object.properties.keys())):
            label = QLabel(prop + ':')
            editor = QLineEdit(self.flume_object.properties[prop]["value"])
            if prop == "type":
                editor.setReadOnly(True)
            if self.flume_object.properties[prop]["required"]:
                label.setText(prop + ":*")
                pass  # label.setFont(QFont) TODO
            editor.setToolTip(self.flume_object.properties[prop]["description"])
            editor.setToolTipDuration(-1)

            self.new_properties[prop] = editor

            label.setBuddy(self.new_properties[prop])
            layout.addWidget(label, idx, 0)
            layout.addWidget(self.new_properties[prop], idx, 1)

        layout.addWidget(button_box)
        self.setLayout(layout)

        button_box.accepted.connect(self.accept_prop)
        button_box.rejected.connect(self.reject)
開發者ID:ADobrodey,項目名稱:Apache-Flume-Editor,代碼行數:32,代碼來源:_manage_properties.py

示例2: GalleryDownloader

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTipDuration [as 別名]
class GalleryDownloader(QWidget):
	"""
	A gallery downloader window
	"""
	def __init__(self, parent):
		super().__init__(None,
				   Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowMinMaxButtonsHint)
		self.setAttribute(Qt.WA_DeleteOnClose)
		main_layout = QVBoxLayout(self)
		self.parent_widget = parent
		self.url_inserter = QLineEdit()
		self.url_inserter.setPlaceholderText("Hover to see supported URLs")
		self.url_inserter.setToolTip(app_constants.SUPPORTED_DOWNLOAD_URLS)
		self.url_inserter.setToolTipDuration(999999999)
		self.url_inserter.returnPressed.connect(self.add_download_entry)
		main_layout.addWidget(self.url_inserter)
		self.info_lbl = QLabel(self)
		self.info_lbl.setAlignment(Qt.AlignCenter)
		main_layout.addWidget(self.info_lbl)
		self.info_lbl.hide()
		buttons_layout = QHBoxLayout()
		url_window_btn = QPushButton('Batch URLs')
		url_window_btn.adjustSize()
		url_window_btn.setFixedWidth(url_window_btn.width())
		def batch_url_win():
			self._batch_url = GalleryDownloaderUrlExtracter()
			self._batch_url.url_emit.connect(self.add_download_entry)
		url_window_btn.clicked.connect(batch_url_win)
		clear_all_btn = QPushButton('Clear List')
		clear_all_btn.adjustSize()
		clear_all_btn.setFixedWidth(clear_all_btn.width())
		buttons_layout.addWidget(url_window_btn, 0, Qt.AlignLeft)
		buttons_layout.addWidget(clear_all_btn, 0, Qt.AlignRight)
		main_layout.addLayout(buttons_layout)
		self.download_list = GalleryDownloaderList(parent.manga_list_view.sort_model, self)
		clear_all_btn.clicked.connect(self.download_list.clear_list)
		download_list_scroll = QScrollArea(self)
		download_list_scroll.setBackgroundRole(self.palette().Base)
		download_list_scroll.setWidgetResizable(True)
		download_list_scroll.setWidget(self.download_list)
		main_layout.addWidget(download_list_scroll, 1)
		close_button = QPushButton('Close', self)
		close_button.clicked.connect(self.hide)
		main_layout.addWidget(close_button)
		self.resize(480,600)
		self.setWindowIcon(QIcon(app_constants.APP_ICO_PATH))

	def add_download_entry(self, url=None):
		log_i('Adding download entry: {}'.format(url))
		self.info_lbl.hide()
		h_item = None
		try:
			if not url:
				url = self.url_inserter.text()
				if not url:
					return
				self.url_inserter.clear()
			url = url.lower()
			
			manager = self.website_validator(url)
			h_item = manager.from_gallery_url(url)
		except app_constants.WrongURL:
			self.info_lbl.setText("<font color='red'>Failed to add:\n{}</font>".format(url))
			self.info_lbl.show()
			return
		except app_constants.NeedLogin:
			self.info_lbl.setText("<font color='red'>Login is required to download:\n{}</font>".format(url))
			self.info_lbl.show()
			return
		except app_constants.WrongLogin:
			self.info_lbl.setText("<font color='red'Wrong login info to download:\n{}</font>".format(url))
			self.info_lbl.show()
			return
		if h_item:
			log_i('Successfully added download entry')
			self.download_list.add_entry(h_item)

	def website_validator(self, url):
		match_prefix = "^(http\:\/\/|https\:\/\/)?(www\.)?([^\.]?)" # http:// or https:// + www.
		match_base = "(.*\.)+" # base. Replace with domain
		match_tld = "[a-zA-Z0-9][a-zA-Z0-9\-]*" # com
		end = "/?$"

		# ATTENTION: the prefix will automatically get prepended to the pattern string! Don't try to match it.

		def regex_validate(r):
			if re.fullmatch(match_prefix+r+end, url):
				return True
			return False

		if regex_validate("((g\.e-hentai)\.org\/g\/[0-9]+\/[a-z0-9]+)"):
			manager = pewnet.HenManager()
		elif regex_validate("((exhentai)\.org\/g\/[0-9]+\/[a-z0-9]+)"):
			exprops = settings.ExProperties()
			if exprops.check():
				manager = pewnet.ExHenManager()
			else:
				return
		elif regex_validate("(panda\.chaika\.moe\/(archive|gallery)\/[0-9]+)"):
			manager = pewnet.ChaikaManager()
#.........這裏部分代碼省略.........
開發者ID:ImoutoChan,項目名稱:happypanda,代碼行數:103,代碼來源:io_misc.py

示例3: GalleryDownloader

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTipDuration [as 別名]
class GalleryDownloader(QWidget):
	"""
	A gallery downloader window
	"""
	def __init__(self, parent):
		super().__init__(None,
				   Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowMinMaxButtonsHint)
		self.setAttribute(Qt.WA_DeleteOnClose)
		main_layout = QVBoxLayout(self)
		self.parent_widget = parent
		self.url_inserter = QLineEdit()
		self.url_inserter.setPlaceholderText("Hover to see supported URLs")
		self.url_inserter.setToolTip(gui_constants.SUPPORTED_DOWNLOAD_URLS)
		self.url_inserter.setToolTipDuration(999999999)
		self.url_inserter.returnPressed.connect(self.add_download_entry)
		main_layout.addWidget(self.url_inserter)
		self.info_lbl = QLabel(self)
		self.info_lbl.setAlignment(Qt.AlignCenter)
		main_layout.addWidget(self.info_lbl)
		self.info_lbl.hide()
		buttons_layout = QHBoxLayout()
		clear_all_btn = QPushButton('Clear List')
		clear_all_btn.adjustSize()
		clear_all_btn.setFixedWidth(clear_all_btn.width())
		buttons_layout.addWidget(clear_all_btn, 0, Qt.AlignRight)
		main_layout.addLayout(buttons_layout)
		self.download_list = GalleryDownloaderList(parent.manga_list_view.sort_model, self)
		clear_all_btn.clicked.connect(self.download_list.clear_list)
		download_list_scroll = QScrollArea(self)
		download_list_scroll.setBackgroundRole(self.palette().Base)
		download_list_scroll.setWidgetResizable(True)
		download_list_scroll.setWidget(self.download_list)
		main_layout.addWidget(download_list_scroll, 1)
		close_button = QPushButton('Close', self)
		close_button.clicked.connect(self.hide)
		main_layout.addWidget(close_button)
		self.resize(480,600)
		self.setWindowIcon(QIcon(gui_constants.APP_ICO_PATH))

	def add_download_entry(self, url=None):
		self.info_lbl.hide()
		h_item = None
		try:
			if not url:
				url = self.url_inserter.text().lower()
				if not url:
					return
				self.url_inserter.clear()
			if 'g.e-hentai.org' in url:
				manager = pewnet.HenManager()
			elif 'exhentai.org' in url:
				exprops = settings.ExProperties()
				if exprops.check():
					manager = pewnet.ExHenManager(exprops.ipb_id, exprops.ipb_pass)
				else:
					return
			elif 'panda.chaika.moe' in url and ('/archive/' in url or '/gallery/' in url):
				manager = pewnet.ChaikaManager()
			else:
				raise pewnet.WrongURL

			h_item = manager.from_gallery_url(url)
		except pewnet.WrongURL:
			self.info_lbl.setText("<font color='red'>Failed to add to download list</font>")
			self.info_lbl.show()
			return
		if h_item:
			self.download_list.add_entry(h_item)

	def show(self):
		if self.isVisible():
			self.activateWindow()
		else:
			super().show()
開發者ID:peaceandpizza,項目名稱:happypanda,代碼行數:76,代碼來源:file_misc.py


注:本文中的PyQt5.QtWidgets.QLineEdit.setToolTipDuration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。