本文整理汇总了Python中PySide.QtUiTools.QUiLoader.close方法的典型用法代码示例。如果您正苦于以下问题:Python QUiLoader.close方法的具体用法?Python QUiLoader.close怎么用?Python QUiLoader.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools.QUiLoader
的用法示例。
在下文中一共展示了QUiLoader.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtUiTools import QUiLoader [as 别名]
# 或者: from PySide.QtUiTools.QUiLoader import close [as 别名]
#.........这里部分代码省略.........
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 == '':
if self.website is not None:
filename = self.website.downloader.title + '.ass'
filepath = os.path.join(os.getcwd(), filename)
else:
filepath = output
output = QFileDialog.getSaveFileName(
self.main_window, u'请选择一个文件', filepath)[0]
if output != '':
if not output.endswith('.ass'):
output += '.ass'
self.output_lineEdit.setText(output)
def convert_pushButton_clicked_slot(self):
font_name, font_size = self.font_pushButton.text().split(' | ')
font_size = int(font_size)
video_width = self.video_width_spinBox.value()
video_height = self.video_height_spinBox.value()
line_count = self.line_count_spinBox.value()
bottom_margin = self.bottom_margin_spinBox.value()
tune_seconds = self.tune_seconds_spinBox.value()
output = self.output_lineEdit.text().strip()
errors = []
if self.website is None:
errors.append(u'未抓取源字幕')
if output == '':
errors.append(u'未选择输出路径')
if len(errors) != 0:
self.alert(QMessageBox.Critical, '\n'.join(errors))
return
text = self.website.ass_subtitles_text(
font_name=font_name,
font_size=font_size,
resolution='%d:%d' % (video_width, video_height),
line_count=line_count,
bottom_margin=bottom_margin,
tune_seconds=tune_seconds
)
output = os.path.abspath(output)
try:
outfile = open(output, 'w')
outfile.write(text.encode('UTF-8'))
outfile.flush()
outfile.close()
except StandardError as error:
self.alert(QMessageBox.Critical, error)
return
message = u'转换成功,文件保存到\n %s' % output
self.alert(QMessageBox.Information, message)
def quit_menuitem_triggered_slot(self):
self.main_window.close()
def about_menuitem_triggered_slot(self):
webbrowser.open('https://github.com/muzuiget/niconvert#readme')