本文整理汇总了Python中error.Error.show方法的典型用法代码示例。如果您正苦于以下问题:Python Error.show方法的具体用法?Python Error.show怎么用?Python Error.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error.Error
的用法示例。
在下文中一共展示了Error.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddForum
# 需要导入模块: from error import Error [as 别名]
# 或者: from error.Error import show [as 别名]
class AddForum(QWidget):
def __init__(self):
super(QWidget, self).__init__()
uic.loadUi('ui/add_forum.ui', self)
self.cursor = con.cursor()
self.add_forum_btb.accepted.connect(self.insert_new)
self.add_forum_btb.rejected.connect(self.close)
self.error = Error()
def insert_new(self):
url = self.txt_url.text()
combobox_item = unicode(self.category_cbb.currentText())
username = str(self.txt_username.text())
passwod = str(self.txt_password.text())
if 'http:' not in url:
self.error.show()
print 'Not valid URL'
else:
self.cursor.execute('INSERT INTO Poster(URL, CATEGORY, USERNAME, PASSWORD) VALUES (?, ?, ?, ?);',
(str(url), combobox_item, username, passwod))
con.commit()
self.close()
示例2: AddPost
# 需要导入模块: from error import Error [as 别名]
# 或者: from error.Error import show [as 别名]
class AddPost(QWidget):
def __init__(self):
super(QWidget, self).__init__()
uic.loadUi('ui/add_post.ui', self)
self.add_data_buttonbox.accepted.connect(self.write_data_to_file)
self.add_data_buttonbox.rejected.connect(self.close)
self.error = Error()
self.home_dir = os.path.expanduser('~')
self.import_file_button.clicked.connect(self.import_from_file)
self.import_file_button.setIcon(QtGui.QIcon('ui/Open.png'))
self.import_file_button.setIconSize(QtCore.QSize(32, 32))
def write_data_to_file(self):
if len(self.txt_body.toPlainText()) <= 50:
print 'Error'
# .encode('utf-8')
self.error.show()
elif len(self.txt_subject.text()) <= 15:
print 'Error'
self.error.show()
else:
f = open('data.txt', 'w+')
f.write(self.txt_body.toPlainText())
f.close()
f1 = open('subject.txt', 'w+')
f1.write(self.txt_subject.text())
f1.close()
self.close()
def import_from_file(self):
unknow = QtGui.QFileDialog.getOpenFileNames(QFileDialog(), "Select files to upload!", self.home_dir)
if unknow:
print unknow[0]
data = open(str(unknow[0]), 'r')
self.txt_body.insertPlainText(data.read())
data.close()