def setField(self, field): self.ui_Field.setText(field) #------------------------------------------------------------ def emitPathChanged(self, path): if not self.signalsBlocked(): self.pathChanged.emit(str(path)) if ( __name__ == '__main__' ): from DTL.qt.QtGui import QVBoxLayout from DTL.gui import Core, Dialog from functools import partial dlg = Dialog() dlg.setWindowTitle( 'Pathwidget Test' ) layout = QVBoxLayout() pathWidget = PathWidget(ext='*.py', label='Pick File', parent=dlg) layout.addWidget(pathWidget) pathWidget = PathWidget(label='Pick Folder', pickerType=PathWidget.pickerTypes.Folder, field='c:/test/my/path', parent=dlg) layout.addWidget(pathWidget) dlg.setLayout(layout)
self._color = color self.refresh() if ( not self.signalsBlocked() ): self.colorChanged.emit( color ) def togglePopup( self ): if ( not self._colorPickerWidget.isVisible() ): w = self.width() if ( w < 120 ): w = 120 self._cancelled = False self._colorPickerWidget.resize( w, 120 ) self._colorPickerWidget.move( self.mapToGlobal( QPoint( 0, self.height() ) ) ) self._colorPickerWidget.setColor( self.color() ) self._colorPickerWidget.show() if ( __name__ == '__main__' ): from DTL.qt.QtGui import QVBoxLayout from DTL.gui import Core, Dialog dlg = Dialog() dlg.setWindowTitle('Color Test') layout = QVBoxLayout() layout.addWidget( ColorPickerWidget(dlg) ) layout.addWidget( ColorPickerButton(dlg) ) dlg.setLayout(layout) dlg.show() Core.Start()