本文整理汇总了Python中PyQt4.QtCore.Qt.LeftButton方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.LeftButton方法的具体用法?Python Qt.LeftButton怎么用?Python Qt.LeftButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.LeftButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: changeToTestConfig
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def changeToTestConfig(self):
listName = "test subreddit"
self.form.subredditList._lstChooser.addItem(listName)
self.form.subredditList._lstChooser.setCurrentIndex(self.form.subredditList._lstChooser.count() - 1)
self.form.subredditList._chooserDict[listName] = ListModel([], self.form.subredditList._classToUse)
self.form.subredditList.chooseNewList(self.form.subredditList._lstChooser.count() - 1)
QTest.mouseClick(self.form.addUserBtn, Qt.LeftButton)
index = self.form.userList.model().createIndex(0, 0)
self.form.userList.model().setData(index, self.userName)
self.assertIn(self.userName, self.form.userList.model().stringsInLst)
QTest.mouseClick(self.form.addSubredditBtn, Qt.LeftButton)
index = self.form.subredditList.model().createIndex(0, 0)
self.form.subredditList.model().setData(index, "reddit_data_extractor")
self.assertIn("reddit_data_extractor", self.form.subredditList.model().stringsInLst)
# Please don't steal this client-id. I don't want to get rate-limited.
self.form._rddtDataExtractor.imgurAPIClientID = 'e0ea61b57d4c3c9'
示例2: download
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def download(self):
QTest.mouseClick(self.form.downloadBtn, Qt.LeftButton)
# gross workarounds for signals being missed due to not being in an event loop in the GUI
redditorValidator = self.form.redditorValidator
maxIter = 2
i = 0
while len(redditorValidator.validUsersOrSubs) <= 0 and i < maxIter:
time.sleep(5)
i += 1
if len(redditorValidator.validUsersOrSubs) > 0:
self.form.downloadValidUserOrSub(redditorValidator.validUsersOrSubs)
i = 0
while not self.form.downloader.finishSignalForTest:
i += 1
time.sleep(5)
print("Took " + str(i) + " iterations to complete download.")
self.form.reactivateBtns()
i = 0
maxIter = 2
while self.form.downloadBtn.text() == "Downloading... Press here to stop the download (In progress downloads will continue until done)." and i < maxIter:
time.sleep(5)
i += 1
示例3: mouseReleaseEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mouseReleaseEvent(self, event):
""" Stop mouse pan or zoom mode (apply zoom if valid).
"""
QGraphicsView.mouseReleaseEvent(self, event)
scenePos = self.mapToScene(event.pos())
if event.button() == Qt.LeftButton:
self.setDragMode(QGraphicsView.NoDrag)
self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y())
elif event.button() == Qt.RightButton:
if self.canZoom:
viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect()
selectionBBox = self.scene.selectionArea().boundingRect().intersected(viewBBox)
self.scene.setSelectionArea(QPainterPath()) # Clear current selection area.
if selectionBBox.isValid() and (selectionBBox != viewBBox):
self.zoomStack.append(selectionBBox)
self.updateViewer()
self.setDragMode(QGraphicsView.NoDrag)
self.rightMouseButtonReleased.emit(scenePos.x(), scenePos.y())
示例4: test_update_pushButton_will_call_environment_update_versions_method
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_update_pushButton_will_call_environment_update_versions_method(self):
"""testing if update_pushButton will call
Test_Environment.update_versions method
"""
self.assertRaises(
KeyError,
self.test_environment.test_data.__getitem__, 'update_versions'
)
# self.show_dialog(self.dialog)
QTest.mouseClick(self.dialog.update_pushButton, Qt.LeftButton)
#print(self.test_environment.test_data)
self.assertEqual(
1,
self.test_environment.test_data['update_versions']['call_count']
)
示例5: test_select_none_pushButton_will_deselect_all_check_boxes_when_clicked
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_select_none_pushButton_will_deselect_all_check_boxes_when_clicked(self):
"""testing if select none pushButton will deselect all the check boxes
when clicked
"""
# check if all are selected
version_tree_model = self.dialog.versions_treeView.model()
# check if we have all items
index = version_tree_model.index(0, 0)
version_item1 = version_tree_model.itemFromIndex(index)
version_item1.setCheckState(QtCore.Qt.Checked)
index = version_tree_model.index(1, 0)
version_item2 = version_tree_model.itemFromIndex(index)
version_item2.setCheckState(QtCore.Qt.Checked)
QTest.mouseClick(self.dialog.selectNone_pushButton, Qt.LeftButton)
self.assertEqual(version_item1.checkState(), QtCore.Qt.Unchecked)
self.assertEqual(version_item2.checkState(), QtCore.Qt.Unchecked)
示例6: test_select_all_pushButton_will_select_all_check_boxes_when_clicked
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_select_all_pushButton_will_select_all_check_boxes_when_clicked(self):
"""testing if select all pushButton will select all the check boxes
when clicked
"""
# check if all are selected
version_tree_model = self.dialog.versions_treeView.model()
# check if we have all items
index = version_tree_model.index(0, 0)
version_item1 = version_tree_model.itemFromIndex(index)
version_item1.setCheckState(QtCore.Qt.Unchecked)
index = version_tree_model.index(1, 0)
version_item2 = version_tree_model.itemFromIndex(index)
version_item2.setCheckState(QtCore.Qt.CheckState.Unchecked)
QTest.mouseClick(self.dialog.selectAll_pushButton, Qt.LeftButton)
self.assertEqual(version_item1.checkState(), QtCore.Qt.Checked)
self.assertEqual(version_item2.checkState(), QtCore.Qt.Checked)
示例7: mousePressEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mousePressEvent(self, ev):
ctrl, shift = self._GetCtrlShift(ev)
repeat = 0
if ev.type() == QEvent.MouseButtonDblClick:
repeat = 1
self._Iren.SetEventInformationFlipY(ev.x(), ev.y(),
ctrl, shift, chr(0), repeat, None)
self._ActiveButton = ev.button()
if self._ActiveButton == Qt.LeftButton:
self._Iren.LeftButtonPressEvent()
elif self._ActiveButton == Qt.RightButton:
self._Iren.RightButtonPressEvent()
elif self._ActiveButton == Qt.MidButton:
self._Iren.MiddleButtonPressEvent()
示例8: testAddRemoveUser
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def testAddRemoveUser(self):
QTest.mouseClick(self.form.addUserBtn, Qt.LeftButton)
self.assertEqual(len(self.form.userList.model().stringsInLst), 1)
self.assertIn("new list item 1", self.form.userList.model().stringsInLst)
QTest.mouseClick(self.form.addUserBtn, Qt.LeftButton)
self.assertEqual(len(self.form.userList.model().stringsInLst), 2)
self.assertIn("new list item 2", self.form.userList.model().stringsInLst)
index = self.form.userList.model().createIndex(0, 0)
self.form.userList.model().setData(index, "rddt_data_extractor")
self.assertNotIn("new list item 1", self.form.userList.model().stringsInLst)
self.assertIn("rddt_data_extractor", self.form.userList.model().stringsInLst)
index = self.form.userList.model().createIndex(1, 0)
self.form.userList.setCurrentIndex(index)
QTest.mouseClick(self.form.deleteUserBtn, Qt.LeftButton)
self.assertNotIn("new list item 2", self.form.userList.model().stringsInLst)
示例9: mousePressEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mousePressEvent(self, event):
""" Start mouse pan or zoom mode.
"""
scenePos = self.mapToScene(event.pos())
if event.button() == Qt.LeftButton:
if self.canPan:
self.setDragMode(QGraphicsView.ScrollHandDrag)
self.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y())
elif event.button() == Qt.RightButton:
if self.canZoom:
self.setDragMode(QGraphicsView.RubberBandDrag)
self.rightMouseButtonPressed.emit(scenePos.x(), scenePos.y())
QGraphicsView.mousePressEvent(self, event)
示例10: mouseDoubleClickEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mouseDoubleClickEvent(self, event):
""" Show entire image.
"""
scenePos = self.mapToScene(event.pos())
if event.button() == Qt.LeftButton:
self.leftMouseButtonDoubleClicked.emit(scenePos.x(), scenePos.y())
elif event.button() == Qt.RightButton:
if self.canZoom:
self.zoomStack = [] # Clear zoom stack.
self.updateViewer()
self.rightMouseButtonDoubleClicked.emit(scenePos.x(), scenePos.y())
QGraphicsView.mouseDoubleClickEvent(self, event)
示例11: test_close_button_closes_ui
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_close_button_closes_ui(self):
"""testing if the close button is closing the ui
"""
self.dialog.show()
self.assertEqual(self.dialog.isVisible(), True)
# now run the UI
QTest.mouseClick(self.dialog.close_pushButton, Qt.LeftButton)
self.assertEqual(self.dialog.isVisible(), False)
示例12: test_copy_button_clicked_with_no_selection_on_from_task_tree_view
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_copy_button_clicked_with_no_selection_on_from_task_tree_view(self):
"""testing if a QMessageDialog will be displayed when the copy button
selected and no selection is made in from_task_tree_view
"""
self.assertEqual(PatchedMessageBox.called_function, '')
# now try to copy it
QTest.mouseClick(self.dialog.copy_push_button, Qt.LeftButton)
self.assertEqual(PatchedMessageBox.called_function, 'critical')
self.assertEqual(PatchedMessageBox.title, 'Error')
self.assertEqual(PatchedMessageBox.message,
'Please select a task from <b>From Task</b> list')
示例13: test_send_pushButton_will_warn_the_user_to_set_the_media_files_path_if_it_is_not_set_before
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def test_send_pushButton_will_warn_the_user_to_set_the_media_files_path_if_it_is_not_set_before(self):
"""testing if send_pushButton will warn the user to set the media files
path in preferences if it is not set before
"""
# set a proper EDL file
edl_path = os.path.abspath('../previs/test_data/test_v001.edl')
self.dialog.edl_path_lineEdit.setText(edl_path)
# patch QMessageBox.critical method
original = QtGui.QMessageBox.critical
QtGui.QMessageBox = PatchedMessageBox
self.assertEqual(PatchedMessageBox.called_function, '')
self.assertEqual(PatchedMessageBox.title, '')
self.assertEqual(PatchedMessageBox.message, '')
# now hit it
QTest.mouseClick(self.dialog.send_pushButton, Qt.LeftButton)
# restore QMessageBox.critical
QtGui.QMessageBox.critical = original
self.assertEqual(PatchedMessageBox.called_function, 'critical')
self.assertEqual(PatchedMessageBox.title, 'Error')
self.assertEqual(
"Media path doesn't exists",
PatchedMessageBox.message
)
示例14: mousePressEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mousePressEvent(self, ev):
ctrl, shift = self._GetCtrlShift(ev)
repeat = 0
if ev.type() == QEvent.MouseButtonDblClick:
repeat = 1
self._Iren.SetEventInformationFlipY(ev.x(), ev.y(),
ctrl, shift, chr(0), repeat, None)
self._ActiveButton = ev.button()
if self._ActiveButton == Qt.LeftButton:
self._Iren.LeftButtonPressEvent()
elif self._ActiveButton == Qt.RightButton:
self._Iren.RightButtonPressEvent()
elif self._ActiveButton == Qt.MidButton:
self._Iren.MiddleButtonPressEvent()
#def mouseReleaseEvent(self, ev):
# ctrl, shift = self._GetCtrlShift(ev)
# self._Iren.SetEventInformationFlipY(ev.x(), ev.y(),
# ctrl, shift, chr(0), 0, None)
# if self._ActiveButton == Qt.LeftButton:
# self._Iren.LeftButtonReleaseEvent()
# elif self._ActiveButton == Qt.RightButton:
# self._Iren.RightButtonReleaseEvent()
# elif self._ActiveButton == Qt.MidButton:
# self._Iren.MiddleButtonReleaseEvent()
示例15: mouseReleaseEvent
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import LeftButton [as 别名]
def mouseReleaseEvent(self, ev):
ctrl, shift = self._GetCtrlShift(ev)
self._Iren.SetEventInformationFlipY(ev.x(), ev.y(),
ctrl, shift, chr(0), 0, None)
if self._ActiveButton == Qt.LeftButton:
self._Iren.LeftButtonReleaseEvent()
elif self._ActiveButton == Qt.RightButton:
self._Iren.RightButtonReleaseEvent()
elif self._ActiveButton == Qt.MidButton:
self._Iren.MiddleButtonReleaseEvent()