本文整理汇总了Python中PyQt4.Qt.QTextEdit.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QTextEdit.setEnabled方法的具体用法?Python QTextEdit.setEnabled怎么用?Python QTextEdit.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTextEdit
的用法示例。
在下文中一共展示了QTextEdit.setEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TwitterGui
# 需要导入模块: from PyQt4.Qt import QTextEdit [as 别名]
# 或者: from PyQt4.Qt.QTextEdit import setEnabled [as 别名]
class TwitterGui(QWidget):
URL_REGEX = re.compile(r'''((?:mailto:|ftp://|http://|https://)[^ <>'"{}|\\^`[\]]*)''')
def __init__(self, parent, logger, db_conn, update_func, safe_conn):
super(TwitterGui, self).__init__(parent)
self._db_conn = db_conn
self.logger = logger
self._reply_to_id = 0
self._update_func = update_func
self._list = None
if get_settings().get_proxy():
u = urlparse.urlsplit(get_settings().get_proxy())
proxy = QNetworkProxy()
proxy.setType(QNetworkProxy.HttpProxy)
proxy.setHostName(u.hostname);
proxy.setPort(u.port)
QNetworkProxy.setApplicationProxy(proxy);
self.msgview = QWebView(self)
self.msgview.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
self.msgview.linkClicked.connect(self.link_clicked)
self.userCombo = QComboBox(self)
self.userCombo.setEditable(True)
self.userCombo.activated.connect(self.toggle_user_in_list)
self.showButton = QPushButton(chr(94), self)
self.showButton.setMaximumHeight(13)
self.showButton.clicked.connect(self.show_hide_animation)
self.post_field = QTextEdit(self)
self.post_field.setMaximumHeight(50)
self.post_field.textChanged.connect(self.text_changed)
self.send_button = QPushButton("Post", self)
self.send_button.clicked.connect(self.post_status_clicked)
self.refresh_button = QPushButton("Refresh", self)
self.refresh_button.clicked.connect(self._update_func)
self.attach_button = QPushButton("Attach", self)
self.attach_button.clicked.connect(lambda _ : self.set_status("Attach something"))
self.lists_box = QComboBox(self)
self.lists_box.currentIndexChanged.connect(self.list_changed)
self.lists_box.setEditable(False)
self.lists_box.addItems([u"Home"] + self._db_conn.get_lists())
self.statusLabel = QLabel("Status", self)
self.charCounter = QLabel("0", self)
self.gridw = QWidget(self)
self.gridw.setContentsMargins(0, 0, 0, 0)
gridlay = QGridLayout(self.gridw)
gridlay.setContentsMargins(0, 0, 0, 0)
gridlay.addWidget(self.post_field, 0, 0, 2, 1)
gridlay.addWidget(self.attach_button, 0, 1, 1, 1)
gridlay.addWidget(self.send_button, 1, 1, 1, 1)
gridlay.addWidget(self.lists_box, 0, 2, 1, 1)
gridlay.addWidget(self.refresh_button, 1, 2, 1, 1)
gridlay.addWidget(self.statusLabel, 2, 0, 1, 1)
gridlay.addWidget(self.charCounter, 2, 1, 1, 2)
hlay = QVBoxLayout(self)
hlay.addWidget(self.msgview)
hlay.addWidget(self.userCombo)
hlay.addWidget(self.showButton)
hlay.addWidget(self.gridw)
safe_conn.connect_home_timeline_updated(self.update_view)
safe_conn.connect_twitter_loop_started(self.start_refresh_animation)
safe_conn.connect_twitter_loop_stopped(self.stop_refresh_animation)
safe_conn.connect_update_posted(self.enable_posting)
safe_conn.connect_range_limit_exceeded(lambda _ : self.set_status("Range limit exceeded"))
safe_conn.connect_not_authenticated(lambda _ : self.set_status("Authentication failed"))
self.gridw.hide()
self.update_view()
self.set_status("Twitter plugin initialized")
def enable_posting(self, q_id, m_id):
if m_id>1:
self.post_field.setText("")
self.set_status("Tweet posted")
else:
self.set_status("Failed to post tweet, Error: " + str(abs(m_id)))
self.post_field.setEnabled(True)
def link_clicked(self, url):
if not url.host():
if url.hasQueryItem("reply-to") and url.hasQueryItem("screen-name"):
self._reply_to_id = long(convert_string(url.queryItemValue("reply-to")))
self.post_field.setPlainText("@"+convert_string(url.queryItemValue("screen-name"))+" ")
self.set_status("Reply to @"+convert_string(url.queryItemValue("screen-name")))
else:
self.logger.error("Unknown command from link: "+str(url.toString()))
else:
webbrowser.open(str(url.toString()))
def list_changed(self, list_idx):
if list_idx:
self._list = convert_string(self.lists_box.currentText())
#.........这里部分代码省略.........