pyside

How to use QTimer inside QThread which uses QWaitCondition? (pyside)

好久不见. 提交于 2020-01-01 19:27:13
问题 I'm using pyside but (I think) is a generic Qt question. I know that QThread implementation calls ._exec() method so we should have an event loop on a started QThread. This way we can use QTimer on that thread (I've done this and it works perfectly). My problem is when QWaitCondition is also used, I'd like to have a "consumer" thread with a infinite loop waiting to be notify (from producers) on the QWaitCondition. The problem I have is that with this design I cannot use QTimer inside the

How to delete QTreeWidgetItem

混江龙づ霸主 提交于 2020-01-01 08:52:53
问题 Several webpages say that QTreeWidgetItem can be deleted by deleting or QTreeWidget.clear ing. But my code sample below doesn't seem to do so. Am I doing anything wrong? #!/usr/bin/python import sys from PySide.QtGui import QApplication, QWidget, QTreeWidget, QTreeWidgetItem #from PyQt4.QtGui import QApplication, QWidget, QTreeWidget, QTreeWidgetItem # Result was the same with `PySide` import time class TreeWidgetItemChild(QTreeWidgetItem): def __init__(self): super(TreeWidgetItemChild, self)

PySide and python logging

和自甴很熟 提交于 2020-01-01 06:23:52
问题 I want to use PySide to create a simple application just to output from python logging. def mpm_print(): print 'OK' def mpm_log(): log.info('OK') class LabWindow(QtGui.QMainWindow): def __init__(self): super(LabWindow, self).__init__() self.initUI() mpm_print() mpm_log() def initUI(self): font = QtGui.QFont() font.setFamily("Courier") font.setFixedPitch(True) font.setPointSize(10) self.qtxt = QtGui.QTextEdit(self) self.qtxt.resize(self.size()) self.qtxt.setReadOnly(True) self.qtxt.setFont

What is the best approach with compiling PySide application

杀马特。学长 韩版系。学妹 提交于 2020-01-01 03:39:06
问题 I have lot of pain while compiling pyside code for Linux...much less for Windows, and my source is around 300kb. I would like to know what is the safest way to compile it. Is it the best to compile Qt, PySide bindings, Python 2.7, and every import with separate process? 1.1. If I do it this way, is it easier to trace errors? Does qt4-qmake have any reason to use it while compiling? Is it better to rewrite code for PyQt instead of Pyside? Are it depending about happy combination of some

pyside qtreewidget constrain drag and drop

那年仲夏 提交于 2019-12-31 16:02:06
问题 I'm trying to add a constraint to the QTreeWidget drag and drop function to prevent the branches from entering another branch in another root. Here's an example to make things more clear: I have 4 objects. Lets call them apple, banana, carrot, durian. The tree looks like this: isDelicious (Root) |-- BackgroundObjects (Branch) |-- Durian |-- ForgroundObjects (Branch) |-- Apple |-- Banana |-- Carrot isSmelly (Root) |-- BackgroundObjects (Branch) |-- Apple |-- Carrot |-- ForgroundObjects (Branch

Run Python binaries under Windows XP

心不动则不痛 提交于 2019-12-31 04:26:13
问题 I compiled my PySide application to both x32 and x64 mode and it's work under Windows 7+. However I found that the application can't start under Windows XP. Should I use some tricks in spec-file additionally? Current PyInstaller script shown below in app.spec file: pyinstaller src/app.spec # -*- mode: python -*- import os import platform from PySide import QtCore onefile = False console = False platform_name = platform.system().lower() app_name = {'linux': 'app', 'darwin': 'app', 'windows':

Check something at regular intervals in a Python (Qt) application

只愿长相守 提交于 2019-12-31 04:10:54
问题 I'm writing a GUI application using Python and Qt as a GUI library. I would like to perform certain scheduled actions after e.g. 3 days or so (but some more often, some even more rare etc). I have discovered the QTimer() app but my understanding is that it only tracks time while the software is running. So, for example, suppose a user has checked the option to check the automatic updates every 5 days. If he runs it on day one, everything is fine. The countdown clock starts ticking. But if he

How to send a keyboard shortcut for a menu item with QTest?

浪尽此生 提交于 2019-12-31 04:01:08
问题 In a unit test, I'm trying to send the keyboard shortcut Command+N (on Mac OS), which corresponds to a menu item in my app. I'm using the PySide.QtTest module. In the code below, I'm using QTest.keyClicks , which doesn't produce what I'm expecting. The action corresponding to the shortcut is not called. class AppTestCase(TestCase): def setUp(self): qApp = QApplication.instance() if qApp is None: self.app = QApplication([]) else: self.app = qApp class IdfEditorTestCase(th.AppTestCase): def

Qt QGraphicsDropShadowEffect is not showing

只谈情不闲聊 提交于 2019-12-30 10:59:34
问题 I am creating a custom widget my_widget inheriting from QWidget . Here, I have a label to which I would like to apply QGraphicsDropShadowEffect however it does not seem to be working since I don't see any shadows. My code is in Python and it's: eff = QGraphicsDropShadowEffect() self.my_widget_label.setGraphicsEffect(eff) I tried various alterations to this code to no avail. After doing a through search on Google, I came across many similar questions without answers. What might be the cause?

Qt QGraphicsDropShadowEffect is not showing

隐身守侯 提交于 2019-12-30 10:59:07
问题 I am creating a custom widget my_widget inheriting from QWidget . Here, I have a label to which I would like to apply QGraphicsDropShadowEffect however it does not seem to be working since I don't see any shadows. My code is in Python and it's: eff = QGraphicsDropShadowEffect() self.my_widget_label.setGraphicsEffect(eff) I tried various alterations to this code to no avail. After doing a through search on Google, I came across many similar questions without answers. What might be the cause?