本文整理汇总了Python中PySide.QtUiTools.QUiLoader.frameGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python QUiLoader.frameGeometry方法的具体用法?Python QUiLoader.frameGeometry怎么用?Python QUiLoader.frameGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools.QUiLoader
的用法示例。
在下文中一共展示了QUiLoader.frameGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtUiTools import QUiLoader [as 别名]
# 或者: from PySide.QtUiTools.QUiLoader import frameGeometry [as 别名]
class NiconvertQt:
def __init__(self):
ui_file_path = os.path.join(__folder__, 'niconvert_qt.ui')
self.main_window = QUiLoader().load(ui_file_path)
for widget in self.main_window.findChildren(QObject):
name = widget.objectName()
if name == '' or name.startswith('qt_') or name.startswith('_'):
continue
setattr(self, name, widget)
self.init_widgets_status()
self.bind_signals()
self.website = None
def init_widgets_status(self):
if sys.platform == 'win32':
self.font_pushButton.setText(u'微软雅黑 | 36')
else:
self.font_pushButton.setText('WenQuanYi Micro Hei | 36')
self.move_to_screen_center()
self.main_window.resize(480, 0)
def move_to_screen_center(self):
cp = QDesktopWidget().availableGeometry().center()
qr = self.main_window.frameGeometry()
qr.moveCenter(cp)
self.main_window.move(qr.topLeft())
def bind_signals(self):
self.quit_menuitem.triggered.connect(
self.quit_menuitem_triggered_slot)
self.about_menuitem.triggered.connect(
self.about_menuitem_triggered_slot)
self.fetch_pushButton.clicked.connect(
self.fetch_pushButton_clicked_slot)
self.font_pushButton.clicked.connect(
self.font_pushButton_clicked_slot)
self.output_lineEdit.editingFinished.connect(
self.output_lineEdit_editingFinished_slot)
self.output_pushButton.clicked.connect(
self.output_pushButton_clicked_slot)
self.convert_pushButton.clicked.connect(
self.convert_pushButton_clicked_slot)
def alert(self, message_type, message_text):
dialog = QMessageBox()
dialog.setIcon(message_type)
dialog.setText('%s' % message_text)
dialog.exec_()
def fetch_pushButton_clicked_slot(self):
url = self.url_lineEdit.text().strip()
if not url.startswith('http://'):
return
try:
self.website = create_website(url)
except StandardError as error:
self.video_title_label.setText('')
self.comment_url_label.setText('')
self.website = None
self.alert(QMessageBox.Critical, error)
return
if self.website is None:
self.alert(QMessageBox.Critical, u'不支持的网站')
return
title = self.website.downloader.title
url = self.website.downloader.comment_url
markup = '<a href="%s">%s</a>' % (url, url)
self.video_title_label.setText(title)
self.comment_url_label.setText(markup)
if self.output_lineEdit.text().strip() == '':
self.output_lineEdit.setText(title + '.ass')
def font_pushButton_clicked_slot(self):
font_name, font_size = self.font_pushButton.text().split(' | ')
font_size = int(font_size)
font, respose = QFontDialog.getFont(
QFont(font_name, font_size), self.main_window)
if respose:
font_label = '%s | %d' % (
font.family(), font.pointSize())
self.font_pushButton.setText(font_label)
def output_lineEdit_editingFinished_slot(self):
text = self.output_lineEdit.text().strip()
if text != '' and not text.endswith('.ass'):
text += '.ass'
self.output_lineEdit.setText(text)
def output_pushButton_clicked_slot(self):
filename = 'output.ass'
output = self.output_lineEdit.text().strip()
if output == '':
#.........这里部分代码省略.........