def createTaskWidgets(self):
'''Create one task widget for every task found in current task store'''
## START OF NAUGHTY CODE
# DELETE TASK CONTAINER AND SCROLL AREA SO WE CAN RE-CREATE THEM
# FOR SOME REASON RE-USING THE EXISTING ONES DOES NOT SHOW THE TASK WIDGETS
self.taskContainer.deleteLater()
self.scrollArea.deleteLater()
self.taskContainer = QtGui.QWidget()
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setWidget(self.taskContainer)
self.layout().addWidget(self.scrollArea)
## END OF NAUGHTY CODE
self.taskWidgets = [TaskWidget(t, self.taskContainer) for t in self.taskStore.tasks]
self.update()
python类QWidget()的实例源码
def __init__(self):
QtGui.QWidget.__init__(self)
self.ui = Ui_Settings()
self.ui.setupUi(self)
self.tools_path = None
self.scripts_path = None
self.gs = None
self.output_path = None
self.threads = 4
self.jobs = 2
self. iteration = 5
self.ui.tools_location_selecet_bn.clicked.connect(self.select_tools_path)
self.ui.tools_location_clear_bn.clicked.connect(self.clear_tools_path)
self.ui.scripts_location_selecet_bn.clicked.connect(self.select_scripts_path)
self.ui.scripts_location_clear_bn.clicked.connect(self.clear_scripts_path)
self.ui.threads_spinBox.setValue(self.threads)
self.ui.threads_spinBox.setMinimum(1)
self.ui.jobs_spinBox.setValue(self.jobs)
self.ui.jobs_spinBox.setMinimum(1)
self.ui.iteration_spinBox.setValue(self. iteration)
self.ui.iteration_spinBox.setMinimum(1)
self.ui.output_select_bn.clicked.connect(self.select_output_path)
self.ui.output_clear_bn.clicked.connect(self.clear_output_path)
self.ui.setting_confirm_frame.accepted.connect(self.confirm)
self.ui.setting_confirm_frame.rejected.connect(self.cancel)
def __init__(self, observer, view, fields):
self._observer = observer
self._fields = fields
self._connectors = {}
self.logger = module_logger.getChild('Binder')
widgets = {}
for obj in view.findChildren(QtGui.QWidget):
if obj.objectName() in fields and isinstance(obj, tuple(self.bound_widgets)):
try:
widgets[obj.__class__].append(obj)
except KeyError:
widgets[obj.__class__] = []
widgets[obj.__class__].append(obj)
try:
for cls, items in widgets.items():
cntr = self.bound_widgets[cls]
for widget in items:
self._connectors[widget.objectName()] = cntr(self, widget)
except KeyError:
pass
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None):
QtGui.QWidget.__init__(self, parent)
self._low_freq = low_freq
self._high_freq = high_freq
self._spacing = spacing
self._delay= delay
self._data = self._open_data(data)
self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay)
main_layout = QtGui.QGridLayout()
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(self.render_area, 0, 0)
self.setLayout(main_layout)
self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def fv(name="vertical",title=''):
# w=QtGui.QWidget()
t=QtGui.QLabel("my widget")
w=MyDockWidget(t,"Reconstruction WB")
### w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
if title <>'': w.setWindowTitle(title)
layout = QtGui.QVBoxLayout()
layout.setAlignment(QtCore.Qt.AlignTop)
#w.layout=layout
#w.setLayout(layout)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
w.show()
# ComboViewShowWidget(w,True)
try:
FreeCAD.w5.append(w)
except:
FreeCAD.w5=[w]
return w
def fh(name="horizontal",title=''):
w=QtGui.QWidget()
#w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
layout = QtGui.QHBoxLayout()
layout.setAlignment(QtCore.Qt.AlignLeft)
w.setLayout(layout)
# Gruppenname setzen:
#pB= QtGui.QLabel("name")
#pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
#layout.addWidget(pB)
if title <>'': w.setWindowTitle(title)
#w.show()
#ComboViewShowWidget(w,False)
w.layout=layout
return w
def fh2(name="vertik horizontal",title=''):
w=QtGui.QWidget()
#w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
layout = QtGui.QVBoxLayout()
layout.setAlignment(QtCore.Qt.AlignLeft)
w.setLayout(layout)
#pB= QtGui.QLabel("name")
#pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
#layout.addWidget(pB)
if title <>'': w.setWindowTitle(title)
#w.show()
#ComboViewShowWidget(w,False)
w.layout=layout
return w
def main():
#MaxPlus.FileManager.Reset(True)
w = QtGui.QWidget()
MaxPlus.AttachQWidgetToMax(w)
if _GCProtector.widgets :
w = _GCProtector.widgets
print w
w.resize(250, 100)
w.setWindowTitle('Window')
_GCProtector.widgets = w
w.show()
main_layout = QtGui.QVBoxLayout()
label = QtGui.QLabel("Click button to create a cylinder in the scene")
main_layout.addWidget(label)
cylinder_btn = QtGui.QPushButton("Cylinder")
main_layout.addWidget(cylinder_btn)
w.setLayout(main_layout)
cylinder_btn.clicked.connect(make_cylinder)
def _get_dialog_parent(self):
"""
Get the QWidget parent for all dialogs created through
show_dialog & show_modal.
"""
"""
Get the QWidget parent for all dialogs created through
show_dialog & show_modal.
"""
# determine the parent widget to use:
from tank.platform.qt import QtGui, QtCore
if not self._DIALOG_PARENT:
if sys.platform == "win32":
# for windows, we create a proxy window parented to the
# main application window that we can then set as the owner
# for all Toolkit dialogs
self._DIALOG_PARENT = self._win32_get_proxy_window()
else:
self._DIALOG_PARENT = QtGui.QApplication.activeWindow()
return self._DIALOG_PARENT
def LayoutDesign(self):
self.widget = QtGui.QWidget()
self.layout = QtGui.QGridLayout(self.widget)
self.layout.setSpacing(1)
self.layout.setHorizontalSpacing(0)
self.layout.setVerticalSpacing(0)
self.scroll = QtGui.QScrollArea()
self.scroll.setWidgetResizable(True)
self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.scroll.setWidget(self.widget)
self.LayoutChangesOnSliceChange(self.Electrode.slices)
self.layout.addWidget(self.CustomWebView, 1, 0,1,25, QtCore.Qt.AlignLeft)
self.layout.setContentsMargins(0, 0, 0, 0)
self.setContentsMargins(0, 0, 0, 0)
self.grid1 = QtGui.QGridLayout()
self.grid1.addWidget(self.scroll,3,0)
self.setLayout(self.grid1)
def MaintainLayout(self):
self.InterfaceWidget =QtGui.QWidget()
self.InterfaceWidget.setContentsMargins(0, 0, 0, 0)
self.InterfaceLayout = QtGui.QVBoxLayout()
ConsensusPlot = QtGui.QHBoxLayout()
#
self.InterfaceLayout.setContentsMargins(0, 0, 0, 0)
# self.communitiesAcrossTimeStep.PlotWidget.setMinimumSize(200,100)
# self.communitiesAcrossTimeStep.PlotWidget.setMaximumSize(200,100)
# ConsensusPlot.addWidget(self.communitiesAcrossTimeStep.PlotWidget)
self.InterfaceLayout.addWidget(self.Visualizer.MainTab)
self.InterfaceLayout.setContentsMargins(0, 0, 0, 0)
self.InterfaceLayout.addLayout(ConsensusPlot)
self.InterfaceLayout.setContentsMargins(0, 0, 0, 0)
self.InterfaceWidget.setContentsMargins(0, 0, 0, 0)
self.InterfaceWidget.setLayout(self.InterfaceLayout)
self.InterfaceWidget.setContentsMargins(0, 0, 0, 0)
self.InterfaceWidget.show()
# def connectCustomWebView(self, view):
# self.view = view
# self.Visualizer.SliceInterval.valueChanged[int].connect(self.view.slicesChanged)
CommunitiesAcrossTimestepInterrface.py 文件源码
项目:ECoG-ClusterFlow
作者: sugeerth
项目源码
文件源码
阅读 17
收藏 0
点赞 0
评论 0
def __init__(self, AcrossTimestepUI, AcrossTimestepObject):
QtGui.QWidget.__init__(self)
self.UIWidget = QtGui.QVBoxLayout()
self.Widget1 = QtGui.QWidget()
self.AcrossTimestepUI = AcrossTimestepUI
self.AcrossTimestepObject = AcrossTimestepObject
self.defaultValue = "0.3"
self.ConnectControls()
self.doControls()
self.UIWidget.setContentsMargins(0,0,0,0)
self.UIWidget.addWidget(self.AcrossTimestepUI)
self.UIWidget.setContentsMargins(0,0,0,0)
# self.AcrossTimestepUI.thresholdvalue.hide()
self.setLayout(self.UIWidget)
def create_icon_box(self, name, text):
style = 'width:48px;height:48px;background-color:white;border-radius:5px;border:1px solid rgb(50,50,50);'
icon_label = QtGui.QLabel()
icon_label.setStyleSheet(style)
icon_label.setMaximumWidth(48)
icon_label.setMinimumWidth(48)
icon_label.setMaximumHeight(48)
icon_label.setMinimumHeight(48)
setattr(self, name, icon_label)
icon_text = QtGui.QLabel(text)
icon_text.setStyleSheet('font-size:10px;')
icon_text.setAlignment(QtCore.Qt.AlignCenter)
vbox = QVBoxLayout()
vbox.setAlignment(QtCore.Qt.AlignCenter)
vbox.addWidget(icon_label)
vbox.addWidget(icon_text)
vbox.setContentsMargins(0, 0, 0, 0)
w = QtGui.QWidget()
w.setLayout(vbox)
w.setMaximumWidth(70)
return w
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None):
QtGui.QWidget.__init__(self, parent)
self._low_freq = low_freq
self._high_freq = high_freq
self._spacing = spacing
self._delay= delay
self._data = self._open_data(data)
self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay)
main_layout = QtGui.QGridLayout()
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(self.render_area, 0, 0)
self.setLayout(main_layout)
self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def __init__(self, *args,**kwargs):
super(MainWidget, self).__init__(*args,**kwargs)
self.setLayout(QtGui.QHBoxLayout())
self.bkg_wdgt = QtGui.QWidget()
self.layout().addWidget(self.bkg_wdgt)
self.bkg_wdgt.setLayout(QtGui.QHBoxLayout())
self.btn = QtGui.QPushButton("hallo")
self.textarea = QtGui.QTextEdit()
self.bkg_wdgt.layout().addWidget(self.btn)
self.bkg_wdgt.layout().addWidget(self.textarea)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.btn.clicked.connect(self.on_btn_clicked)
# self.parent_hwnd = None
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None):
QtGui.QWidget.__init__(self, parent)
self._low_freq = low_freq
self._high_freq = high_freq
self._spacing = spacing
self._delay= delay
self._data = self._open_data(data)
self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay)
main_layout = QtGui.QGridLayout()
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(self.render_area, 0, 0)
self.setLayout(main_layout)
self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def createTaskWidgets(self):
'''Create one task widget for every task found in current task store'''
## START OF NAUGHTY CODE
# DELETE TASK CONTAINER AND SCROLL AREA SO WE CAN RE-CREATE THEM
# FOR SOME REASON RE-USING THE EXISTING ONES DOES NOT SHOW THE TASK WIDGETS
self.taskContainer.deleteLater()
self.scrollArea.deleteLater()
self.taskContainer = QtGui.QWidget()
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setWidget(self.taskContainer)
self.layout().addWidget(self.scrollArea)
## END OF NAUGHTY CODE
self.taskWidgets = [TaskWidget(t, self.taskContainer) for t in self.taskStore.tasks]
self.update()
def __init__(self, sandbox, *args, **kwargs):
QtGui.QDockWidget.__init__(self, 'Sources', *args, **kwargs)
self.sandbox = sandbox
layout = QtGui.QVBoxLayout()
layout.setContentsMargins(3, 3, 3, 3)
sources = SourcesList(sandbox)
sources_add_menu = SourcesAddButton(sandbox)
self.setFeatures(QtGui.QDockWidget.DockWidgetFloatable |
QtGui.QDockWidget.DockWidgetMovable)
self.widget = QtGui.QWidget()
self.widget.setLayout(layout)
self.widget.layout().addWidget(sources)
self.widget.layout().addWidget(sources_add_menu)
self.setWidget(self.widget)
def MySaveDialog(target=None):
'''widget for save sketch into a file'''
lm=getfiles()
w=QtGui.QWidget()
w.target=target
box = QtGui.QVBoxLayout()
w.setLayout(box)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
w.r=QtGui.QPushButton("save selected sketch as file")
box.addWidget(w.r)
w.r.pressed.connect(lambda :saveSketch(w))
w.show()
return w
def dialogV(obj):
'''erzeugen dialog vLayout'''
w=QtGui.QWidget()
box = QtGui.QVBoxLayout()
w.setLayout(box)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
for p in obj.props:
pw=createPropWidget( obj,p)
box.addWidget(pw)
w.r=QtGui.QPushButton("close")
box.addWidget(w.r)
w.r.pressed.connect(lambda :clear(w))
w.show()
return w
##create controller main dialog
def fv(name="vertical",title=''):
# w=QtGui.QWidget()
t=QtGui.QLabel("my widget")
w=MyDockWidget(t,"Reconstruction WB")
### w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
if title <>'': w.setWindowTitle(title)
layout = QtGui.QVBoxLayout()
layout.setAlignment(QtCore.Qt.AlignTop)
#w.layout=layout
#w.setLayout(layout)
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
w.show()
# ComboViewShowWidget(w,True)
try:
FreeCAD.w5.append(w)
except:
FreeCAD.w5=[w]
return w
def fv3(name="vertical",title=''):
''' vertical layout but not a dock widget'''
w=QtGui.QWidget()
# w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
if title <>'': w.setWindowTitle(title)
layout = QtGui.QVBoxLayout()
layout.setAlignment(QtCore.Qt.AlignTop)
#w.layout=layout
#w.setLayout(layout)
# w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
# w.show()
try: FreeCAD.w5.append(w)
except: FreeCAD.w5=[w]
return w
def fh2(name="vertik horizontal",title=''):
w=QtGui.QWidget()
#w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
layout = QtGui.QVBoxLayout()
layout.setAlignment(QtCore.Qt.AlignLeft)
w.setLayout(layout)
#pB= QtGui.QLabel("name")
#pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}")
#layout.addWidget(pB)
if title <>'': w.setWindowTitle(title)
#w.show()
#ComboViewShowWidget(w,False)
w.layout=layout
return w
def init_params(self):
QtGui.QWidget().setLayout(self.params_vbox)
parts_vbox = QtGui.QGridLayout(self.params_widget)
self.hide_button = QtGui.QPushButton('Hide others', self.params_widget)
parts_vbox.addWidget(self.hide_button, 0, 0)
self.hide_button.clicked.connect(self.hide_others)
self.show_button = QtGui.QPushButton('Show all', self.params_widget)
parts_vbox.addWidget(self.show_button, 0, 1)
self.show_button.clicked.connect(self.show_initial_objects)
self.set_transparency_button = QtGui.QPushButton('Set transparent', self.params_widget)
parts_vbox.addWidget(self.set_transparency_button, 1, 0)
self.set_transparency_button.clicked.connect(self.set_transparency)
self.reset_transparency_button = QtGui.QPushButton('Restore transparent', self.params_widget)
parts_vbox.addWidget(self.reset_transparency_button, 1, 1)
self.reset_transparency_button.clicked.connect(self.restore_transparency)
preview_button = QtGui.QPushButton('Preview', self.params_widget)
parts_vbox.addWidget(preview_button,2,0,1,2)
preview_button.clicked.connect(self.preview)
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None):
QtGui.QWidget.__init__(self, parent)
self._low_freq = low_freq
self._high_freq = high_freq
self._spacing = spacing
self._data = self._open_data(data)
self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay)
main_layout = QtGui.QGridLayout()
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(self.render_area, 0, 0)
self.setLayout(main_layout)
self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def refreshRelativeFrame(self):
# clear the frame of all widgets first
for child in self.relative_frame.findChildren(QtGui.QWidget):
child.setParent(None)
# fill the relative frames list
for index in range(self.mRelativeFrameAmount + 1):
if not index-self.mRelativeFrameAmount/2 == 0:
listWidget = OnionListFrame()
listWidget.frame_number.setText(str(index-self.mRelativeFrameAmount/2))
listWidget.frame_opacity_slider.setValue(75/abs(index-self.mRelativeFrameAmount/2))
listWidget.frame_visibility_btn.clicked.connect(self.toggleRelativeFrame)
listWidget.frame_opacity_slider.sliderMoved.connect(self.setRelativeOpacity)
self.relative_frame_layout.addWidget(listWidget)
#
def __init__(self, media, parent):
super(VideoMediaView, self).__init__(media, parent)
self._widget = QWidget(parent)
self._process = QProcess(self._widget)
self._process.setObjectName('%s-process' % self.objectName())
self._std_out = []
self._errors = []
self._stopping = False
self._mute = False
if 'mute' in self._options:
self._mute = bool(int(self._options['mute']))
self._widget.setGeometry(media['_geometry'])
self.connect(self._process, SIGNAL("error()"), self._process_error)
self.connect(self._process, SIGNAL("finished()"), self.stop)
self.connect(self._process, SIGNAL("readyReadStandardOutput()"), self.__grep_std_out)
self.set_default_widget_prop()
self._stop_timer = QTimer(self)
self._stop_timer.setSingleShot(True)
self._stop_timer.setInterval(1000)
self._stop_timer.timeout.connect(self._force_stop)
def __init__(self):
super(MultiAutoSettingsDialog, self).__init__()
vl = QtGui.QVBoxLayout()
self.setLayout(vl)
self.headerWidget = QtGui.QWidget()
vl.addWidget(self.headerWidget)
self.__qsw = QtGui.QStackedLayout()
self.__autoWidgets = []
vl.addLayout(self.__qsw)
bb = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
vl.addWidget(bb)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.__saved_pos = QtGui.QCursor.pos()
def __init__(self):
QtGui.QWidget.__init__(self)
self.ui = Ui_About()
self.ui.setupUi(self)
self.ui.about_bn.clicked.connect(self.confirm)
def __init__(self):
QtGui.QWidget.__init__(self)
self.ui = Ui_Manual()
self.ui.setupUi(self)
self.ui.manual_bn.clicked.connect(self.confirm)