Hi guys,
First i would like to apologize if my english is not perfect, it's not my native language.
Second, Thank you in advance for the help u might provide here.
Let me explain my problem. I design a GUI at work with pyQt4 in python3. The target environment is a fork from my company of debian stretch. But since debian 9 is quite recent, my company's fork is not available yet. So till the new OS version is released, the app i design will run in a chroot made to emulate the future environment.
But in this chroot, the default style of Qt is quite ugly (windows 95 like
), so i set a style in my application launcher.
This style is much more pretty than the original one. But with it I can't find a way to have a QFileDialog matching the system file explorer (which I have in default style)...
I hope there is workaround to make me use the style I want and still have a QFileFDialog like the one in my system (nautilus).
Here a simplified version of my code with only the part involved.
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
def __init__(self):
# setting up my widget
super(StartWindow, self).__init__()
# add button to select workspace
self.workspace = None
button.clicked.connect(self.__select_workspace)
self.setCentralWidget(button)
def __select_workspace(self):
self.workspace = dialog.getExistingDirectory(self, 'Select folder',
print(self.workspace)
def main():
# setting up the style i want
app.setStyle("cleanlooks")
_ = StartWindow()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
class StartWindow(QtGui.QMainWindow):
def __init__(self):
# setting up my widget
super(StartWindow, self).__init__()
# add button to select workspace
self.workspace = None
button = QtGui.QPushButton('Select Workspace')
button.clicked.connect(self.__select_workspace)
self.setCentralWidget(button)
def __select_workspace(self):
dialog = QtGui.QFileDialog()
self.workspace = dialog.getExistingDirectory(self, 'Select folder',
options=QtGui.QFileDialog.ShowDirsOnly)
print(self.workspace)
def main():
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
app = QtGui.QApplication(sys.argv)
# setting up the style i want
app.setStyle("cleanlooks")
_ = StartWindow()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
To copy to clipboard, switch view to plain text mode
Bookmarks