example loader allows editing code
Workaround for PySide bug; fixes GradientEditorItem
This commit is contained in:
parent
491aee0fe2
commit
475006f508
@ -36,6 +36,7 @@ vb = pg.ViewBox()
|
|||||||
p1 = pg.PlotDataItem()
|
p1 = pg.PlotDataItem()
|
||||||
vb.addItem(p1)
|
vb.addItem(p1)
|
||||||
|
|
||||||
|
## Just something to play with inside the ViewBox
|
||||||
class movableRect(QtGui.QGraphicsRectItem):
|
class movableRect(QtGui.QGraphicsRectItem):
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
QtGui.QGraphicsRectItem.__init__(self, *args)
|
QtGui.QGraphicsRectItem.__init__(self, *args)
|
||||||
@ -56,8 +57,6 @@ class movableRect(QtGui.QGraphicsRectItem):
|
|||||||
def mouseMoveEvent(self, ev):
|
def mouseMoveEvent(self, ev):
|
||||||
self.setPos(self.mapToParent(ev.pos()) - self.pressDelta)
|
self.setPos(self.mapToParent(ev.pos()) - self.pressDelta)
|
||||||
|
|
||||||
|
|
||||||
#rect = QtGui.QGraphicsRectItem(QtCore.QRectF(0, 0, 1, 1))
|
|
||||||
rect = movableRect(QtCore.QRectF(0, 0, 1, 1))
|
rect = movableRect(QtCore.QRectF(0, 0, 1, 1))
|
||||||
rect.setPen(QtGui.QPen(QtGui.QColor(100, 200, 100)))
|
rect.setPen(QtGui.QPen(QtGui.QColor(100, 200, 100)))
|
||||||
vb.addItem(rect)
|
vb.addItem(rect)
|
||||||
|
@ -88,6 +88,13 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
self.setCentralWidget(self.cw)
|
self.setCentralWidget(self.cw)
|
||||||
self.ui.setupUi(self.cw)
|
self.ui.setupUi(self.cw)
|
||||||
|
|
||||||
|
self.codeBtn = QtGui.QPushButton('Run Edited Code')
|
||||||
|
self.codeLayout = QtGui.QGridLayout()
|
||||||
|
self.ui.codeView.setLayout(self.codeLayout)
|
||||||
|
self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
|
||||||
|
self.codeLayout.addWidget(self.codeBtn, 1, 1)
|
||||||
|
self.codeBtn.hide()
|
||||||
|
|
||||||
global examples
|
global examples
|
||||||
self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples)
|
self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples)
|
||||||
self.ui.exampleTree.expandAll()
|
self.ui.exampleTree.expandAll()
|
||||||
@ -100,6 +107,8 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
|
self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
|
||||||
self.ui.pyqtCheck.toggled.connect(self.pyqtToggled)
|
self.ui.pyqtCheck.toggled.connect(self.pyqtToggled)
|
||||||
self.ui.pysideCheck.toggled.connect(self.pysideToggled)
|
self.ui.pysideCheck.toggled.connect(self.pysideToggled)
|
||||||
|
self.ui.codeView.textChanged.connect(self.codeEdited)
|
||||||
|
self.codeBtn.clicked.connect(self.runEditedCode)
|
||||||
|
|
||||||
def pyqtToggled(self, b):
|
def pyqtToggled(self, b):
|
||||||
if b:
|
if b:
|
||||||
@ -127,8 +136,8 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
return os.path.join(path, item.file)
|
return os.path.join(path, item.file)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def loadFile(self):
|
def loadFile(self, edited=False):
|
||||||
fn = self.currentFile()
|
|
||||||
extra = []
|
extra = []
|
||||||
if self.ui.pyqtCheck.isChecked():
|
if self.ui.pyqtCheck.isChecked():
|
||||||
extra.append('pyqt')
|
extra.append('pyqt')
|
||||||
@ -138,6 +147,19 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
if self.ui.forceGraphicsCheck.isChecked():
|
if self.ui.forceGraphicsCheck.isChecked():
|
||||||
extra.append(str(self.ui.forceGraphicsCombo.currentText()))
|
extra.append(str(self.ui.forceGraphicsCombo.currentText()))
|
||||||
|
|
||||||
|
|
||||||
|
#if sys.platform.startswith('win'):
|
||||||
|
#os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra)
|
||||||
|
#else:
|
||||||
|
#os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
|
||||||
|
|
||||||
|
if edited:
|
||||||
|
proc = subprocess.Popen([sys.executable, '-'] + extra, stdin=subprocess.PIPE)
|
||||||
|
code = str(self.ui.codeView.toPlainText()).encode('UTF-8')
|
||||||
|
proc.stdin.write(code)
|
||||||
|
proc.stdin.close()
|
||||||
|
else:
|
||||||
|
fn = self.currentFile()
|
||||||
if fn is None:
|
if fn is None:
|
||||||
return
|
return
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
@ -145,7 +167,6 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
else:
|
else:
|
||||||
os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
|
os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
|
||||||
|
|
||||||
|
|
||||||
def showFile(self):
|
def showFile(self):
|
||||||
fn = self.currentFile()
|
fn = self.currentFile()
|
||||||
if fn is None:
|
if fn is None:
|
||||||
@ -155,6 +176,14 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
fn = os.path.join(fn, '__main__.py')
|
fn = os.path.join(fn, '__main__.py')
|
||||||
text = open(fn).read()
|
text = open(fn).read()
|
||||||
self.ui.codeView.setPlainText(text)
|
self.ui.codeView.setPlainText(text)
|
||||||
|
self.ui.loadedFileLabel.setText(fn)
|
||||||
|
self.codeBtn.hide()
|
||||||
|
|
||||||
|
def codeEdited(self):
|
||||||
|
self.codeBtn.show()
|
||||||
|
|
||||||
|
def runEditedCode(self):
|
||||||
|
self.loadFile(edited=True)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
app = QtGui.QApplication([])
|
app = QtGui.QApplication([])
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>762</width>
|
<width>623</width>
|
||||||
<height>302</height>
|
<height>380</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="exampleTree">
|
<widget class="QTreeWidget" name="exampleTree">
|
||||||
@ -90,19 +90,40 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="loadBtn">
|
<widget class="QPushButton" name="loadBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Example</string>
|
<string>Run Example</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextBrowser" name="codeView">
|
<widget class="QWidget" name="">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="loadedFileLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Monospace</family>
|
<weight>75</weight>
|
||||||
<pointsize>10</pointsize>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="codeView">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>FreeMono</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file './examples/exampleLoaderTemplate.ui'
|
# Form implementation generated from reading ui file './exampleLoaderTemplate.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Dec 24 00:33:38 2012
|
# Created: Mon Feb 25 09:02:09 2013
|
||||||
# by: PyQt4 UI code generator 4.9.1
|
# by: PyQt4 UI code generator 4.9.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ except AttributeError:
|
|||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName(_fromUtf8("Form"))
|
Form.setObjectName(_fromUtf8("Form"))
|
||||||
Form.resize(762, 302)
|
Form.resize(623, 380)
|
||||||
self.gridLayout = QtGui.QGridLayout(Form)
|
self.gridLayout = QtGui.QGridLayout(Form)
|
||||||
self.gridLayout.setMargin(0)
|
self.gridLayout.setMargin(0)
|
||||||
self.gridLayout.setSpacing(0)
|
self.gridLayout.setSpacing(0)
|
||||||
@ -25,46 +25,60 @@ class Ui_Form(object):
|
|||||||
self.splitter = QtGui.QSplitter(Form)
|
self.splitter = QtGui.QSplitter(Form)
|
||||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.splitter.setObjectName(_fromUtf8("splitter"))
|
self.splitter.setObjectName(_fromUtf8("splitter"))
|
||||||
self.layoutWidget = QtGui.QWidget(self.splitter)
|
self.widget = QtGui.QWidget(self.splitter)
|
||||||
self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
|
self.widget.setObjectName(_fromUtf8("widget"))
|
||||||
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
|
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
|
||||||
self.verticalLayout.setMargin(0)
|
self.verticalLayout.setMargin(0)
|
||||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||||
self.exampleTree = QtGui.QTreeWidget(self.layoutWidget)
|
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
||||||
self.exampleTree.setObjectName(_fromUtf8("exampleTree"))
|
self.exampleTree.setObjectName(_fromUtf8("exampleTree"))
|
||||||
self.exampleTree.headerItem().setText(0, _fromUtf8("1"))
|
self.exampleTree.headerItem().setText(0, _fromUtf8("1"))
|
||||||
self.exampleTree.header().setVisible(False)
|
self.exampleTree.header().setVisible(False)
|
||||||
self.verticalLayout.addWidget(self.exampleTree)
|
self.verticalLayout.addWidget(self.exampleTree)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||||
self.pyqtCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.pyqtCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.pyqtCheck.setObjectName(_fromUtf8("pyqtCheck"))
|
self.pyqtCheck.setObjectName(_fromUtf8("pyqtCheck"))
|
||||||
self.horizontalLayout.addWidget(self.pyqtCheck)
|
self.horizontalLayout.addWidget(self.pyqtCheck)
|
||||||
self.pysideCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.pysideCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.pysideCheck.setObjectName(_fromUtf8("pysideCheck"))
|
self.pysideCheck.setObjectName(_fromUtf8("pysideCheck"))
|
||||||
self.horizontalLayout.addWidget(self.pysideCheck)
|
self.horizontalLayout.addWidget(self.pysideCheck)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||||
self.forceGraphicsCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.forceGraphicsCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.forceGraphicsCheck.setObjectName(_fromUtf8("forceGraphicsCheck"))
|
self.forceGraphicsCheck.setObjectName(_fromUtf8("forceGraphicsCheck"))
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
||||||
self.forceGraphicsCombo = QtGui.QComboBox(self.layoutWidget)
|
self.forceGraphicsCombo = QtGui.QComboBox(self.widget)
|
||||||
self.forceGraphicsCombo.setObjectName(_fromUtf8("forceGraphicsCombo"))
|
self.forceGraphicsCombo.setObjectName(_fromUtf8("forceGraphicsCombo"))
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
self.loadBtn = QtGui.QPushButton(self.layoutWidget)
|
self.loadBtn = QtGui.QPushButton(self.widget)
|
||||||
self.loadBtn.setObjectName(_fromUtf8("loadBtn"))
|
self.loadBtn.setObjectName(_fromUtf8("loadBtn"))
|
||||||
self.verticalLayout.addWidget(self.loadBtn)
|
self.verticalLayout.addWidget(self.loadBtn)
|
||||||
self.codeView = QtGui.QTextBrowser(self.splitter)
|
self.widget1 = QtGui.QWidget(self.splitter)
|
||||||
|
self.widget1.setObjectName(_fromUtf8("widget1"))
|
||||||
|
self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget1)
|
||||||
|
self.verticalLayout_2.setMargin(0)
|
||||||
|
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
|
||||||
|
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("Monospace"))
|
font.setBold(True)
|
||||||
font.setPointSize(10)
|
font.setWeight(75)
|
||||||
|
self.loadedFileLabel.setFont(font)
|
||||||
|
self.loadedFileLabel.setText(_fromUtf8(""))
|
||||||
|
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.loadedFileLabel.setObjectName(_fromUtf8("loadedFileLabel"))
|
||||||
|
self.verticalLayout_2.addWidget(self.loadedFileLabel)
|
||||||
|
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily(_fromUtf8("FreeMono"))
|
||||||
self.codeView.setFont(font)
|
self.codeView.setFont(font)
|
||||||
self.codeView.setObjectName(_fromUtf8("codeView"))
|
self.codeView.setObjectName(_fromUtf8("codeView"))
|
||||||
|
self.verticalLayout_2.addWidget(self.codeView)
|
||||||
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
self.retranslateUi(Form)
|
||||||
@ -78,5 +92,5 @@ class Ui_Form(object):
|
|||||||
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Load Example", None, QtGui.QApplication.UnicodeUTF8))
|
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Run Example", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file './examples/exampleLoaderTemplate.ui'
|
# Form implementation generated from reading ui file './exampleLoaderTemplate.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Dec 24 00:33:39 2012
|
# Created: Mon Feb 25 09:02:09 2013
|
||||||
# by: pyside-uic 0.2.13 running on PySide 1.1.2
|
# by: pyside-uic 0.2.13 running on PySide 1.1.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ from PySide import QtCore, QtGui
|
|||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName("Form")
|
Form.setObjectName("Form")
|
||||||
Form.resize(762, 302)
|
Form.resize(623, 380)
|
||||||
self.gridLayout = QtGui.QGridLayout(Form)
|
self.gridLayout = QtGui.QGridLayout(Form)
|
||||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.gridLayout.setSpacing(0)
|
self.gridLayout.setSpacing(0)
|
||||||
@ -20,46 +20,60 @@ class Ui_Form(object):
|
|||||||
self.splitter = QtGui.QSplitter(Form)
|
self.splitter = QtGui.QSplitter(Form)
|
||||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.splitter.setObjectName("splitter")
|
self.splitter.setObjectName("splitter")
|
||||||
self.layoutWidget = QtGui.QWidget(self.splitter)
|
self.widget = QtGui.QWidget(self.splitter)
|
||||||
self.layoutWidget.setObjectName("layoutWidget")
|
self.widget.setObjectName("widget")
|
||||||
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
|
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
|
||||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.exampleTree = QtGui.QTreeWidget(self.layoutWidget)
|
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
||||||
self.exampleTree.setObjectName("exampleTree")
|
self.exampleTree.setObjectName("exampleTree")
|
||||||
self.exampleTree.headerItem().setText(0, "1")
|
self.exampleTree.headerItem().setText(0, "1")
|
||||||
self.exampleTree.header().setVisible(False)
|
self.exampleTree.header().setVisible(False)
|
||||||
self.verticalLayout.addWidget(self.exampleTree)
|
self.verticalLayout.addWidget(self.exampleTree)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
self.pyqtCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.pyqtCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.pyqtCheck.setObjectName("pyqtCheck")
|
self.pyqtCheck.setObjectName("pyqtCheck")
|
||||||
self.horizontalLayout.addWidget(self.pyqtCheck)
|
self.horizontalLayout.addWidget(self.pyqtCheck)
|
||||||
self.pysideCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.pysideCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.pysideCheck.setObjectName("pysideCheck")
|
self.pysideCheck.setObjectName("pysideCheck")
|
||||||
self.horizontalLayout.addWidget(self.pysideCheck)
|
self.horizontalLayout.addWidget(self.pysideCheck)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
self.forceGraphicsCheck = QtGui.QCheckBox(self.layoutWidget)
|
self.forceGraphicsCheck = QtGui.QCheckBox(self.widget)
|
||||||
self.forceGraphicsCheck.setObjectName("forceGraphicsCheck")
|
self.forceGraphicsCheck.setObjectName("forceGraphicsCheck")
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
||||||
self.forceGraphicsCombo = QtGui.QComboBox(self.layoutWidget)
|
self.forceGraphicsCombo = QtGui.QComboBox(self.widget)
|
||||||
self.forceGraphicsCombo.setObjectName("forceGraphicsCombo")
|
self.forceGraphicsCombo.setObjectName("forceGraphicsCombo")
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.forceGraphicsCombo.addItem("")
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.forceGraphicsCombo.addItem("")
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.forceGraphicsCombo.addItem("")
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
self.loadBtn = QtGui.QPushButton(self.layoutWidget)
|
self.loadBtn = QtGui.QPushButton(self.widget)
|
||||||
self.loadBtn.setObjectName("loadBtn")
|
self.loadBtn.setObjectName("loadBtn")
|
||||||
self.verticalLayout.addWidget(self.loadBtn)
|
self.verticalLayout.addWidget(self.loadBtn)
|
||||||
self.codeView = QtGui.QTextBrowser(self.splitter)
|
self.widget1 = QtGui.QWidget(self.splitter)
|
||||||
|
self.widget1.setObjectName("widget1")
|
||||||
|
self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget1)
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("Monospace")
|
font.setWeight(75)
|
||||||
font.setPointSize(10)
|
font.setBold(True)
|
||||||
|
self.loadedFileLabel.setFont(font)
|
||||||
|
self.loadedFileLabel.setText("")
|
||||||
|
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.loadedFileLabel.setObjectName("loadedFileLabel")
|
||||||
|
self.verticalLayout_2.addWidget(self.loadedFileLabel)
|
||||||
|
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("FreeMono")
|
||||||
self.codeView.setFont(font)
|
self.codeView.setFont(font)
|
||||||
self.codeView.setObjectName("codeView")
|
self.codeView.setObjectName("codeView")
|
||||||
|
self.verticalLayout_2.addWidget(self.codeView)
|
||||||
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
self.retranslateUi(Form)
|
||||||
@ -73,5 +87,5 @@ class Ui_Form(object):
|
|||||||
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Load Example", None, QtGui.QApplication.UnicodeUTF8))
|
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Run Example", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
if not hasattr(sys, 'frozen'):
|
if not hasattr(sys, 'frozen'):
|
||||||
|
if __file__ == '<stdin>':
|
||||||
|
path = os.getcwd()
|
||||||
|
else:
|
||||||
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
path.rstrip(os.path.sep)
|
path.rstrip(os.path.sep)
|
||||||
if 'pyqtgraph' in os.listdir(path):
|
if 'pyqtgraph' in os.listdir(path):
|
||||||
|
@ -782,7 +782,8 @@ class GradientEditorItem(TickSliderItem):
|
|||||||
self.sigGradientChangeFinished.emit(self)
|
self.sigGradientChangeFinished.emit(self)
|
||||||
|
|
||||||
|
|
||||||
class Tick(GraphicsObject):
|
class Tick(QtGui.QGraphicsObject): ## NOTE: Making this a subclass of GraphicsObject instead results in
|
||||||
|
## activating this bug: https://bugreports.qt-project.org/browse/PYSIDE-86
|
||||||
## private class
|
## private class
|
||||||
|
|
||||||
sigMoving = QtCore.Signal(object)
|
sigMoving = QtCore.Signal(object)
|
||||||
@ -802,7 +803,7 @@ class Tick(GraphicsObject):
|
|||||||
self.pg.lineTo(QtCore.QPointF(scale/3**0.5, scale))
|
self.pg.lineTo(QtCore.QPointF(scale/3**0.5, scale))
|
||||||
self.pg.closeSubpath()
|
self.pg.closeSubpath()
|
||||||
|
|
||||||
GraphicsObject.__init__(self)
|
QtGui.QGraphicsObject.__init__(self)
|
||||||
self.setPos(pos[0], pos[1])
|
self.setPos(pos[0], pos[1])
|
||||||
if self.movable:
|
if self.movable:
|
||||||
self.setZValue(1)
|
self.setZValue(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user