def __init__(self, parent=None, frame=QtWidgets.QFrame.Box):
super(FIRSTUI.ScrollWidget, self).__init__()
# Container Widget
widget = QtWidgets.QWidget()
# Layout of Container Widget
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
widget.setLayout(self.layout)
# Scroll Area Properties
scroll = QtWidgets.QScrollArea()
scroll.setFrameShape(frame)
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll.setWidgetResizable(True)
scroll.setWidget(widget)
# Scroll Area Layer add
scroll_layout = QtWidgets.QVBoxLayout(self)
scroll_layout.addWidget(scroll)
scroll_layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(scroll_layout)
python类QFrame()的实例源码
def __init__(self):
QtWidgets.QColorDialog.__init__(self)
self.setOption(QtWidgets.QColorDialog.NoButtons)
"""
QColorDialog
[0] PyQt5.QtWidgets.QVBoxLayout
[1] PyQt5.QtWidgets.QWidget | Basic Color Grid
[2] PyQt5.QtWidgets.QLabel | Basic Color Label
[3] PyQt5.QtWidgets.QPushButton | Pick Screen Color Button
[4] PyQt5.QtWidgets.QLabel | Background for the colour preview
[5] PyQt5.QtWidgets.QWidget | Custom Color Grid
[6] PyQt5.QtWidgets.QLabel | Custom Color Label
[7] PyQt5.QtWidgets.QPushButton | Add to Custom Colors Button
[8] PyQt5.QtWidgets.QFrame | Hue Saturation Picker
[9] PyQt5.QtWidgets.QWidget | Intensity Slider
[10] PyQt5.QtWidgets.QWidget | Value and Preview
[11] PyQt5.QtWidgets.QDialogButtonBox | Dialog Buttons
[12] PyQt5.QtCore.QTimer | ???
"""
self.children()[10].children()[16].setText("&Hex:")
[self.children()[1].setParent(None) for elem in range(7)] # Remove elements 1-7
self.updateColor()
# Elements 0, 8, 9, 10, 11 are important
def __init__(self, parent=None):
QtWidgets.QFrame.__init__(self, parent)
# No title bar, but keep the frame
# self.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
# Set position of the frame
self.screen = QtWidgets.QDesktopWidget().screenGeometry()
# Set geometry
self.setGeometry(self.screen.width()/8, 50, 1600, 900)
self.setMinimumSize(0, 0)
# Set Widgets
self.sideWindow = SideFrame(self)
self.mainWindow = MainFrame(self)
# Set Layout
self.appLayout = QtWidgets.QHBoxLayout()
self.appLayout.addWidget(self.sideWindow, 2)
self.appLayout.addWidget(self.mainWindow, 8)
# Add layout
self.appLayout.setContentsMargins(0, 0, 0, 0)
self.appLayout.setSpacing(0)
self.setLayout(self.appLayout)
self.setWindowTitle("Bayesian Adaptive Trial Simulator")
# Close the application
def __init__(self, parent=None):
QtWidgets.QFrame.__init__(self, parent=parent)
self.logger = QtWidgets.QPlainTextEdit(parent=self)
self.logger.setReadOnly(True)
self.logger.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
self.logger.setMinimumWidth(1100)
self.buffer = ''
self.clear_button = QtWidgets.QPushButton('Clear Log', parent=self)
self.clear_button.clicked.connect(self.clear_log)
self.save_button = QtWidgets.QPushButton('Save Log As...', parent=self)
self.save_button.clicked.connect(self.save_log)
self.lay = QtWidgets.QVBoxLayout(self)
self.lay.addWidget(self.logger)
self.lay.addWidget(self.clear_button)
self.lay.addWidget(self.save_button)
def __init__(self, *args):
QtWidgets.QFrame.__init__(self, *args)
self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Sunken)
self.edit = self.PlainTextEdit()
self.number_bar = self.NumberBar(self.edit)
hbox = QtWidgets.QHBoxLayout(self)
hbox.setSpacing(0)
hbox.setContentsMargins(0,0,0,0) # setMargin
hbox.addWidget(self.number_bar)
hbox.addWidget(self.edit)
self.edit.blockCountChanged.connect(self.number_bar.adjustWidth)
self.edit.updateRequest.connect(self.number_bar.updateContents)
def view_configuration_info(self):
self.thread_stop = True
container = QtWidgets.QVBoxLayout()
label = QtWidgets.QLabel('Configuration Information')
label.setStyleSheet('font: 18px;')
container.addWidget(label)
layout = QtWidgets.QHBoxLayout()
self.message = QtWidgets.QLabel()
layout.addWidget(self.message)
layout.addStretch()
save_button = QtWidgets.QPushButton('Save')
layout.addWidget(save_button)
scroll_layout = FIRSTUI.ScrollWidget(frame=QtWidgets.QFrame.NoFrame)
FIRSTUI.SharedObjects.server_config_layout(self, scroll_layout, FIRST.config)
container.addWidget(scroll_layout)
container.addStretch()
container.addLayout(layout)
save_button.clicked.connect(self.save_config)
return container
def layout(self):
"""
Layout the row for this experiment.
"""
self._main_layout = QW.QGridLayout(self)
# Construct the header for the experiment
self._main_layout.addWidget(QW.QLabel(self._expt_label),0,0)
# -------------- Buttons --------------------
# Button to show experiment options
self._show_options_button = QW.QPushButton("", self)
self._show_options_button.clicked.connect(self._options_callback)
self._show_options_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","more-info.png")))
self._show_options_button.setIconSize(QC.QSize(21,21))
self._show_options_button.setFixedWidth(30)
self._main_layout.addWidget(self._show_options_button,0,1)
# Button to remove experiment
self._remove_button = QW.QPushButton("", self)
self._remove_button.clicked.connect(self._remove_callback)
self._remove_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","delete-icon.png")))
self._remove_button.setIconSize(QC.QSize(21,21))
self._remove_button.setFixedWidth(30)
self._main_layout.addWidget(self._remove_button,0,2)
self.setFrameShape(QW.QFrame.StyledPanel)
if self._experiment is None:
self._show_options_button.setDisabled(True)
self._remove_button.setDisabled(True)
def horizontal_line():
line = QtWidgets.QFrame()
line.setFrameShape(QtWidgets.QFrame.HLine)
line.setFrameShadow(QtWidgets.QFrame.Sunken)
return line
def setupUi(self, AboutDialog):
AboutDialog.setObjectName("AboutDialog")
AboutDialog.resize(640, 480)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(AboutDialog.sizePolicy().hasHeightForWidth())
AboutDialog.setSizePolicy(sizePolicy)
self.verticalLayout = QtWidgets.QVBoxLayout(AboutDialog)
self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
self.verticalLayout.setSpacing(16)
self.verticalLayout.setObjectName("verticalLayout")
self.frame_pixmap = QtWidgets.QFrame(AboutDialog)
self.frame_pixmap.setStyleSheet("background-color: #fffdfd")
self.frame_pixmap.setObjectName("frame_pixmap")
self.layout_pixmap = QtWidgets.QVBoxLayout(self.frame_pixmap)
self.layout_pixmap.setContentsMargins(4, 3, 4, 3)
self.layout_pixmap.setSpacing(0)
self.layout_pixmap.setObjectName("layout_pixmap")
self.label_pixmap = QtWidgets.QLabel(self.frame_pixmap)
self.label_pixmap.setText("")
self.label_pixmap.setObjectName("label_pixmap")
self.layout_pixmap.addWidget(self.label_pixmap)
self.verticalLayout.addWidget(self.frame_pixmap)
self.label_description = QtWidgets.QLabel(AboutDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_description.sizePolicy().hasHeightForWidth())
self.label_description.setSizePolicy(sizePolicy)
self.label_description.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_description.setWordWrap(True)
self.label_description.setOpenExternalLinks(True)
self.label_description.setObjectName("label_description")
self.verticalLayout.addWidget(self.label_description)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.retranslateUi(AboutDialog)
QtCore.QMetaObject.connectSlotsByName(AboutDialog)
def __init__(self, parent=None):
QtWidgets.QFrame.__init__(self, parent)
# Set layout
self.sideLayout = QtWidgets.QVBoxLayout()
# Widgets
self.sideTitle = SideTitle(parent)
self.sideSpacer = QtWidgets.QSpacerItem(240, 150)
self.sideMenu = SideMenu(parent)
# Run side information
# Show when running a task
self.sideRunMenu = SideRunMenu(parent)
# Hide when intialize
self.sideRunMenu.setVisible(False)
# Option
self.sideOption = SideOption(parent)
# Add widgets
self.sideLayout.addWidget(self.sideTitle, 1)
self.sideLayout.insertStretch(1, 1)
self.sideLayout.addWidget(self.sideMenu, 7)
self.sideLayout.addWidget(self.sideRunMenu, 7)
self.sideLayout.addWidget(self.sideOption, 0)
# Add layout
self.sideLayout.setContentsMargins(0, 0, 0, 0)
self.sideLayout.setSpacing(0)
self.setLayout(self.sideLayout)
# Stylesheet
self.setStyleSheet("background:#399ee5; ")
# Side Title
def __init__(self, parent=None):
QtWidgets.QFrame.__init__(self, parent)
# Layout
self.mainLayout = QtWidgets.QVBoxLayout()
# Widget
self.mainTitle = MainTitle(parent)
self.mainSeparator = QtWidgets.QWidget()
self.mainSeparator.setStyleSheet("background:#e9f0f5; margin: 10px 0 10px 0;")
self.mainSeparator.setFixedHeight(2)
self.mainContent = MainContent(self)
# Add widget
self.mainLayout.addWidget(self.mainTitle, 0)
self.mainLayout.addWidget(self.mainSeparator, 1)
self.mainLayout.addWidget(self.mainContent, 9)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.mainLayout.setSpacing(0)
self.mainLayout.setAlignment(QtCore.Qt.AlignCenter)
# Set layout
self.setLayout(self.mainLayout)
# Stylesheet
self.setStyleSheet("background:#ffffff; border: none;")
# Main Title
def __init__(self, parent = None, root_name = "", currentfile = ""):
QtWidgets.QFrame.__init__(self, parent)
self.parent = parent
self.setMinimumHeight(400)
self.setMaximumHeight(400)
self.plot_font = QtGui.QFont('Bitter', 11)
self.setStyleSheet("QFrame{border: 2px solid #e9f0f5; border-radius:5px; border-left:4px solid #baddef;} QFrame:hover{border: 2px solid #faaba4; border-left:4px solid #fa7064; color: #55b1f2; }")
self.plot_layout = QtWidgets.QVBoxLayout()
self.plot_title_layout = QtWidgets.QHBoxLayout()
self.plot_title = QtWidgets.QLabel()
# Read only the name
self.plot_title.setText(root_name)
self.plot_title.setFont(self.plot_font)
self.plot_title.setStyleSheet("QLabel {border: none;}")
self.plot_title.setWordWrap(True)
self.plot_title_layout.insertStretch(0, 2)
self.plot_title_layout.addWidget(self.plot_title, 6)
self.plot_title_layout.insertStretch(2, 2)
self.plot_graph = GraphLabel()
self.plot_graph.setMargin(0)
self.plot_graph.setStyleSheet("QLabel{border: none;}")
self.currentdir = currentfile.rsplit("/", 1)[0]
self.currentpixmap = QtGui.QPixmap(currentfile).scaled(QtCore.QSize(300, 300))
self.plot_graph.setPixmap(self.currentpixmap)
self.plot_graph.setAlignment(QtCore.Qt.AlignCenter)
self.plot_layout.addWidget(self.plot_graph)
self.plot_layout.addLayout(self.plot_title_layout)
self.plot_layout.setContentsMargins(5, 5, 5, 10)
self.plot_layout.setSpacing(0)
self.setLayout(self.plot_layout)
self.root_name = root_name
# Click event
self.plot_graph.clicked.connect(self.openAllGraph)
# Display
# self.show()
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(640, 977)
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.pushButtonOk = QtWidgets.QPushButton(Dialog)
self.pushButtonOk.setFocusPolicy(QtCore.Qt.NoFocus)
self.pushButtonOk.setLayoutDirection(QtCore.Qt.LeftToRight)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/open-iconic-master/png/check-3x.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButtonOk.setIcon(icon)
self.pushButtonOk.setIconSize(QtCore.QSize(35, 35))
self.pushButtonOk.setDefault(False)
self.pushButtonOk.setFlat(False)
self.pushButtonOk.setObjectName("pushButtonOk")
self.horizontalLayout.addWidget(self.pushButtonOk)
self.pushButtonCancel = QtWidgets.QPushButton(Dialog)
self.pushButtonCancel.setFocusPolicy(QtCore.Qt.NoFocus)
self.pushButtonCancel.setLayoutDirection(QtCore.Qt.LeftToRight)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/icons/open-iconic-master/png/thumb-down-3x.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButtonCancel.setIcon(icon1)
self.pushButtonCancel.setIconSize(QtCore.QSize(35, 35))
self.pushButtonCancel.setDefault(False)
self.pushButtonCancel.setFlat(False)
self.pushButtonCancel.setObjectName("pushButtonCancel")
self.horizontalLayout.addWidget(self.pushButtonCancel)
self.verticalLayout.addLayout(self.horizontalLayout)
self.line = QtWidgets.QFrame(Dialog)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setLineWidth(5)
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setObjectName("line")
self.verticalLayout.addWidget(self.line)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def make_hline():
out = QtWidgets.QFrame()
out.setFrameShape(QtWidgets.QFrame.HLine)
out.setFrameShadow(QtWidgets.QFrame.Sunken)
return out
def __init__(self, *args):
QtWidgets.QPlainTextEdit.__init__(self, *args)
self.setFrameStyle(QtWidgets.QFrame.NoFrame)
self.zoomWheelEnabled = 0
self.highlight()
#self.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
self.cursorPositionChanged.connect(self.highlight)
def setReadOnlyStyle(self, state):
if state == 1:
mainWindowBgColor = QtWidgets.QPalette().color(QtWidgets.QPalette.Window)
self.setStyleSheet('QPlainTextEdit[readOnly="true"] { background-color: %s;} QFrame {border: 0px}' % mainWindowBgColor.name() )
self.setHighlight(0)
else:
self.setStyleSheet('')
self.setHighlight(1)
def __init__(self):
super().__init__()
self.setFrameShape(QtWidgets.QFrame.Box)
self.setFrameShadow(QtWidgets.QFrame.Sunken)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self)
self.horizontalLayout_3.setContentsMargins(3, 0, 3, 0)
self.horizontalLayout_3.setSpacing(0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.upbeatSpinBox = QtWidgets.QSpinBox(self)
self.upbeatSpinBox.setPrefix("")
self.upbeatSpinBox.setMinimum(0)
self.upbeatSpinBox.setMaximum(999999999)
self.upbeatSpinBox.setObjectName("upbeatSpinBox")
self.horizontalLayout_3.addWidget(self.upbeatSpinBox)
self.callTickWidget = QtWidgets.QPushButton(self)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.callTickWidget.sizePolicy().hasHeightForWidth())
self.callTickWidget.setSizePolicy(sizePolicy)
self.callTickWidget.setMaximumSize(QtCore.QSize(25, 16777215))
self.callTickWidget.setFlat(False)
self.callTickWidget.setObjectName("callTickWidget")
self.callTickWidget.setText("?? ")
self.horizontalLayout_3.addWidget(self.callTickWidget)
self.callTickWidget.clicked.connect(self.callClickWidgetForUpbeat)
self.setFocusPolicy(0) #no focus
self.callTickWidget.setFocusPolicy(0) #no focus
self.valueChanged = self.upbeatSpinBox.valueChanged
def make_hline():
out = QtWidgets.QFrame()
out.setFrameShape(QtWidgets.QFrame.HLine)
out.setFrameShadow(QtWidgets.QFrame.Sunken)
return out
def loading_finished(self):
self.doneBt.setStyleSheet("background-color: rgba({}); color: rgba(228,197,134,160);".format(Data.info_bgCOL))
self.doneBt.setFrameShape(QtWidgets.QFrame.Box)
self.doneBt.setFixedHeight(self.hideBt.height())
self.doneBt.setText("Done")
def arrange_properties_panel(self):
self.qs = QSplitter(self)
self.frame = QFrame(parent=self)
layout = QVBoxLayout()
layout.addWidget(self.projectgui.projectproperties)
layout.insertStretch(1)
self.frame.setLayout(layout)
self.qs.addWidget(self.frame)
for x in self.projectgui.projectproperties.findChildren(QSlider):
x.setMinimumWidth(100)
self.qs.addWidget(self.mdi)
self.setCentralWidget(self.qs)
def __init__(self,
xMin=0.0,
xMax=1.0,
yMin=0.0,
yMax=1.0,
xOriginValue=0.5,
yOriginValue=0.5,
xTickInterval=0.1,
yTickInterval=0.1,
labelFont=QFont("Segoe UI", 10),
**kwds):
super(QPlot2D, self).__init__(**kwds)
# create a frame to hold graphics
self._plot_frame = QFrame()
self._plot_layout = QHBoxLayout()
self._plot_layout.addWidget(self._plot_frame)
self.setMinimumSize(100,100)
self.setLayout(self._plot_layout)
# plot parameters
self._xMin = xMin
self._xMax = xMax
self._yMin = yMin
self._yMax = yMax
self._xOriginValue = xOriginValue
self._yOriginValue = yOriginValue
self._xTickInterval = xTickInterval
self._yTickInterval = yTickInterval
self._labelFont = labelFont
# structures to hold plot data
self._plots = {}
self._plot_pens = {}
self._plot_points = {}
self._plot_draw_method = {}
# initialize
self._debug = False
self._set_render_parameters()
# O V E R R I D E M E T H O D S
#===========================================================================
def _load_fitter_info(self):
"""
Load fitter info from pytc.
"""
# get list of Fitter subclasses, sorted by name
objects = []
for name, obj in inspect.getmembers(pytc.fitters):
if inspect.isclass(obj):
objects.append((name,obj))
objects.sort()
self._fitter_classes = []
self._fitter_vars = []
self._fitter_widgets = []
self._fitter_options = []
self._fitter_names = []
self._fitter_radio_buttons = []
self._fitter_defaults = []
# For every Fitter subclass...
for name, obj in objects:
self._fitter_classes.append(obj)
# Make new widget
self._fitter_widgets.append(QW.QFrame())
self._fitter_options.append(QW.QFormLayout(self._fitter_widgets[-1]))
# Add name and radio button to widget
self._fitter_names.append(name.replace("Fitter",""))
self._fitter_radio_buttons.append(QW.QRadioButton(self._fitter_names[-1]))
self._fitter_radio_buttons[-1].toggled.connect(self._select_fit)
# Figure out arguments for this Fitter subclass
args = inspect.getargspec(obj)
if len(args.args) == 1 and args.defaults is None:
self._fitter_defaults.append({})
else:
self._fitter_defaults.append({arg: param for arg, param in
zip(args.args[1:], args.defaults)})
fitter_keys = list(self._fitter_defaults[-1].keys())
fitter_keys.sort()
# Append fit option
self._fitter_vars.append({})
for n in fitter_keys:
label_name = str(n).replace("_", " ") + ": "
label = QW.QLabel(label_name.title(), self)
entry = InputWidget(self._fitter_defaults[-1][n])
self._fitter_vars[-1][n] = entry
self._fitter_options[-1].addRow(label,entry)
# map from name back to index in lists above
self._fitter_name_to_index = dict([(v,i) for i, v in enumerate(self._fitter_names)])
def init_ui(self):
# v.box
gbox = QtWidgets.QGridLayout()
box = QtWidgets.QVBoxLayout()
self.rbox = QtWidgets.QVBoxLayout()
self.hbox = QtWidgets.QHBoxLayout()
# padding/margins
gbox.setContentsMargins(0, 0, 0, 0)
self.rbox.setContentsMargins(0, 0, 10, 10)
self.hbox.setContentsMargins(0, 0, 10, 10)
box.addStretch()
self.hbox.addStretch()
gbox.setSpacing(10)
box.setSpacing(0)
self.rbox.setSpacing(5)
self.hbox.setSpacing(0)
image = QtGui.QImage()
image.loadFromData(urllib.request.urlopen('http://i.imgur.com/04DUqa3.png').read())
png = QLabel(self)
pixmap = QtGui.QPixmap(image)
png.setPixmap(pixmap)
gbox.addWidget(png, 0, 0, 1, 1, Qt.AlignTop)
box.insertSpacing(1, 10)
self.l1 = QLabel(self)
self.l1.setWordWrap(True)
self.large_font.setBold(True)
self.l1.setFont(self.large_font)
box.addWidget(self.l1, 0, Qt.AlignTop)
hline = QtWidgets.QFrame()
hline.setFrameShape(QtWidgets.QFrame.HLine)
hline.setFrameShadow(QtWidgets.QFrame.Sunken)
gbox.addWidget(hline, 0, 0, 1, 3, Qt.AlignBottom)
# start form
self.req_ui()
self.rbox.setAlignment(Qt.AlignTop)
box.addLayout(self.rbox, 1)
gbox.addLayout(box, 0, 1, 1, 2)
gbox.addLayout(self.hbox, 1, 0, 1, 3)
self.setLayout(gbox)
# window
self.setFixedSize(490, 400)
self.setWindowIcon(QtGui.QIcon('red.ico'))
self.setWindowTitle('Red Discord Bot - Setup')
self.show()
def add_roi_frame(self):
self.vbox.setStretch(self.vbox.count()-1, 0)
self.roi_frame = QtWidgets.QFrame(self)
self.vbox.addWidget(self.roi_frame)
self.vbox.addStretch(1)
vbox = QtWidgets.QVBoxLayout()
self.roi_frame.setLayout(vbox)
self.roi_summary = QtWidgets.QLabel('', self)
vbox.addWidget(self.roi_summary)
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
button = QtWidgets.QPushButton('Clear ROIs', self)
button.clicked.connect(self.clear_roi)
hbox.addWidget(button)
hbox.addStretch(1)
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
self.roi_choice = QtWidgets.QGridLayout()
self.current_roi = QtWidgets.QButtonGroup()
hbox.addLayout(self.roi_choice)
hbox.addStretch(1)
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
button = QtWidgets.QPushButton('Prev', self)
button.clicked.connect(self.prev_frame)
hbox.addWidget(button)
button = QtWidgets.QPushButton('Next', self)
button.clicked.connect(self.next_frame)
hbox.addWidget(button)
button = QtWidgets.QPushButton('Random', self)
button.clicked.connect(self.rand_frame)
hbox.addWidget(button)
hbox.addStretch(1)
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
self.class_tag = QtWidgets.QLineEdit('', self)
self.class_tag.setFixedWidth(24)
hbox.addWidget(self.class_tag)
button = QtWidgets.QPushButton('Apply Class', self)
button.clicked.connect(self.apply_class)
hbox.addWidget(button)
hbox.addStretch(1)
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
self.class_fname = QtWidgets.QLineEdit(self.classes.fname, self)
self.class_fname.editingFinished.connect(self.update_name)
hbox.addWidget(self.class_fname)
button = QtWidgets.QPushButton('Save Classes', self)
button.clicked.connect(self.classes.save)
hbox.addWidget(button)
hbox.addStretch(1)
def setupUi(self, modal_ynoc):
modal_ynoc.setObjectName("modal_ynoc")
modal_ynoc.setWindowModality(QtCore.Qt.ApplicationModal)
modal_ynoc.resize(508, 309)
font = QtGui.QFont()
font.setPointSize(12)
modal_ynoc.setFont(font)
modal_ynoc.setStyleSheet("QWidget {\n"
"text-align: center;\n"
"color: black;\n"
"border: none;\n"
"text-decoration: none;\n"
"}")
modal_ynoc.setModal(True)
self.theming = QtWidgets.QFrame(modal_ynoc)
self.theming.setGeometry(QtCore.QRect(0, 0, 508, 309))
self.theming.setStyleSheet("QPushButton {\n"
"background-color: #BAB9BA;\n"
"color: white;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: #8CC5FF;\n"
"}")
self.theming.setObjectName("theming")
self.response = QtWidgets.QDialogButtonBox(self.theming)
self.response.setGeometry(QtCore.QRect(20, 250, 471, 41))
self.response.setStyleSheet("width: 157px; height: 100%;")
self.response.setOrientation(QtCore.Qt.Horizontal)
self.response.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.No|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Yes)
self.response.setCenterButtons(True)
self.response.setObjectName("response")
self.message = QtWidgets.QLabel(self.theming)
self.message.setGeometry(QtCore.QRect(20, 20, 471, 211))
font = QtGui.QFont()
font.setPointSize(12)
self.message.setFont(font)
self.message.setAlignment(QtCore.Qt.AlignCenter)
self.message.setWordWrap(True)
self.message.setObjectName("message")
self.message.raise_()
self.response.raise_()
self.retranslateUi(modal_ynoc)
self.response.accepted.connect(modal_ynoc.accept)
self.response.rejected.connect(modal_ynoc.reject)
QtCore.QMetaObject.connectSlotsByName(modal_ynoc)
def setupUi(self, TabMapSpecific):
TabMapSpecific.setObjectName("TabMapSpecific")
TabMapSpecific.resize(445, 534)
self.gridLayout = QtWidgets.QGridLayout(TabMapSpecific)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.scrollArea_2 = QtWidgets.QScrollArea(TabMapSpecific)
self.scrollArea_2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scrollArea_2.setWidgetResizable(True)
self.scrollArea_2.setObjectName("scrollArea_2")
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 443, 532))
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_2)
self.verticalLayout.setContentsMargins(6, 6, 6, 6)
self.verticalLayout.setSpacing(6)
self.verticalLayout.setObjectName("verticalLayout")
self.selectedMap = QtWidgets.QComboBox(self.scrollAreaWidgetContents_2)
self.selectedMap.setObjectName("selectedMap")
self.verticalLayout.addWidget(self.selectedMap)
self.frame = QtWidgets.QFrame(self.scrollAreaWidgetContents_2)
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.gridLayout_4 = QtWidgets.QGridLayout(self.frame)
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
self.gridLayout_4.setSpacing(0)
self.gridLayout_4.setObjectName("gridLayout_4")
self.mapSpecificOptionsPosition = QtWidgets.QGridLayout()
self.mapSpecificOptionsPosition.setSpacing(0)
self.mapSpecificOptionsPosition.setObjectName("mapSpecificOptionsPosition")
self.gridLayout_4.addLayout(self.mapSpecificOptionsPosition, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.frame)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
self.gridLayout.addWidget(self.scrollArea_2, 0, 0, 1, 1)
self.retranslateUi(TabMapSpecific)
QtCore.QMetaObject.connectSlotsByName(TabMapSpecific)
TabMapSpecific.setTabOrder(self.scrollArea_2, self.selectedMap)
def setupUi(self, RuntimeSettingsDialog):
RuntimeSettingsDialog.setObjectName("RuntimeSettingsDialog")
RuntimeSettingsDialog.resize(844, 243)
self.verticalLayout = QtWidgets.QVBoxLayout(RuntimeSettingsDialog)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setSpacing(0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.label_3 = QtWidgets.QLabel(RuntimeSettingsDialog)
font = QtGui.QFont()
font.setPointSize(14)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.verticalLayout_3.addWidget(self.label_3)
self.label_4 = QtWidgets.QLabel(RuntimeSettingsDialog)
font = QtGui.QFont()
font.setItalic(True)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.verticalLayout_3.addWidget(self.label_4)
self.verticalLayout.addLayout(self.verticalLayout_3)
self.line = QtWidgets.QFrame(RuntimeSettingsDialog)
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.verticalLayout.addWidget(self.line)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.cldevicesSelection = QtWidgets.QListWidget(RuntimeSettingsDialog)
self.cldevicesSelection.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.cldevicesSelection.setObjectName("cldevicesSelection")
self.gridLayout.addWidget(self.cldevicesSelection, 0, 1, 1, 1)
self.label_10 = QtWidgets.QLabel(RuntimeSettingsDialog)
font = QtGui.QFont()
font.setItalic(True)
self.label_10.setFont(font)
self.label_10.setObjectName("label_10")
self.gridLayout.addWidget(self.label_10, 0, 2, 1, 1)
self.label = QtWidgets.QLabel(RuntimeSettingsDialog)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.line_3 = QtWidgets.QFrame(RuntimeSettingsDialog)
self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_3.setObjectName("line_3")
self.verticalLayout.addWidget(self.line_3)
self.buttonBox = QtWidgets.QDialogButtonBox(RuntimeSettingsDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(RuntimeSettingsDialog)
self.buttonBox.accepted.connect(RuntimeSettingsDialog.accept)
self.buttonBox.rejected.connect(RuntimeSettingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(RuntimeSettingsDialog)
def openAllGraph(self):
self.plot_file_list = self.parent.plot_file[self.root_name]
self.graphviewer = QtWidgets.QFrame()
self.screen = QtWidgets.QDesktopWidget().screenGeometry()
# Set geometry
self.graphviewer.setGeometry(self.screen.width()/4, 100, 800, 600)
self.graphviewer.setWindowFlags(QtCore.Qt.Popup)
self.graphviewer.setObjectName("graphView")
self.graphviewer.setStyleSheet("QFrame#graphView{background:#ffffff;border:0.5px solid #fa7064;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
# self.graphviewer.setWindowModality(QtCore.Qt.WindowModal)
# Layout
graph_layout = QtWidgets.QVBoxLayout()
# Title
graph_title = SubTitleBar(self.graphviewer)
graph_title.title_Label.setText(self.root_name)
# Separator line
hline = QtWidgets.QWidget()
hline.setStyleSheet("QWidget{min-height:2px; max-height:2px; background:#399ee5;}")
# ComboBox
graph_control = QtWidgets.QWidget()
graph_control_layout = QtWidgets.QHBoxLayout()
self.graph_control_comboBox = QtWidgets.QComboBox()
self.graph_control_comboBox.setStyleSheet("QComboBox{font-family:'Segoe UI';font-size: 10pt;border: 1px solid #c5d2d9; border-radius:5px;padding: 5px 10px 5px 10px; color: #66767c;min-width: 250px;} QComboBox:hover{border: 2px solid #2a4d69;border-radius: 5px;height: 30ps;} QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border-left-width: 2px;border-left-color: #c5d2d9;border-left-style: solid; border-top-right-radius: 5px; border-bottom-right-radius: 5px;padding: 1px 1px 1px 1px;image: url(:/resources/dropdown_arrow.png);} QComboBox QAbstractItemView {border: 1px solid #c5d2d9; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;selection-background-color:#4b86b4;outline: solid #2a4d69;font-family: 'Segoe UI';font-size: 10pt;color: #66767c;}")
graph_control_layout.insertStretch(0, 4)
graph_control_layout.addWidget(self.graph_control_comboBox)
graph_control_layout.insertStretch(3, 4)
graph_control.setLayout(graph_control_layout)
# Main Content
self.graph_content = QtWidgets.QStackedWidget()
# Add stack
for i in range(1, len(self.plot_file_list)):
currentName = self.plot_file_list[i].rsplit("/", 1)[1].rsplit(".", 1)[0]
self.graph_control_comboBox.addItem(currentName)
graph_label = QtWidgets.QLabel()
currentGraph = QtGui.QPixmap(self.plot_file_list[i])
graph_label.setPixmap(currentGraph)
graph_label.setAlignment(QtCore.Qt.AlignCenter)
self.graph_content.addWidget(graph_label)
# Add layout
graph_layout.addWidget(graph_title, 1)
graph_layout.addWidget(hline, 1)
graph_layout.addWidget(graph_control, 1)
graph_layout.addWidget(self.graph_content, 8)
graph_layout.setContentsMargins(5, 10, 5, 10)
graph_layout.setAlignment(QtCore.Qt.AlignTop)
self.graphviewer.setLayout(graph_layout)
self.graph_control_comboBox.currentIndexChanged.connect(self.changeGraph)
self.graphviewer.show()
def setupUi(self, GoalBody):
GoalBody.setObjectName("GoalBody")
GoalBody.resize(228, 72)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(GoalBody.sizePolicy().hasHeightForWidth())
GoalBody.setSizePolicy(sizePolicy)
self.horizontalLayout = QtWidgets.QHBoxLayout(GoalBody)
self.horizontalLayout.setObjectName("horizontalLayout")
self.frame = QtWidgets.QFrame(GoalBody)
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.frame)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.check_open = QtWidgets.QCheckBox(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.check_open.sizePolicy().hasHeightForWidth())
self.check_open.setSizePolicy(sizePolicy)
self.check_open.setText("")
self.check_open.setObjectName("check_open")
self.horizontalLayout_3.addWidget(self.check_open)
self.label_number = QtWidgets.QLabel(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_number.sizePolicy().hasHeightForWidth())
self.label_number.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_number.setFont(font)
self.label_number.setText("")
self.label_number.setObjectName("label_number")
self.horizontalLayout_3.addWidget(self.label_number)
self.label_goal_name = QtWidgets.QLabel(self.frame)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_goal_name.sizePolicy().hasHeightForWidth())
self.label_goal_name.setSizePolicy(sizePolicy)
self.label_goal_name.setText("")
self.label_goal_name.setObjectName("label_goal_name")
self.horizontalLayout_3.addWidget(self.label_goal_name)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
self.horizontalLayout.addWidget(self.frame)
self.retranslateUi(GoalBody)
QtCore.QMetaObject.connectSlotsByName(GoalBody)
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(867, 300)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout.setObjectName("horizontalLayout")
self.frameOptions = QtWidgets.QFrame(Form)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.frameOptions.sizePolicy().hasHeightForWidth())
self.frameOptions.setSizePolicy(sizePolicy)
self.frameOptions.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frameOptions.setFrameShadow(QtWidgets.QFrame.Plain)
self.frameOptions.setObjectName("frameOptions")
self.gridLayout = QtWidgets.QGridLayout(self.frameOptions)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayoutButtons = QtWidgets.QVBoxLayout()
self.verticalLayoutButtons.setObjectName("verticalLayoutButtons")
self.gridLayout.addLayout(self.verticalLayoutButtons, 0, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.horizontalLayout.addWidget(self.frameOptions)
self.frameWidgets = QtWidgets.QFrame(Form)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.frameWidgets.sizePolicy().hasHeightForWidth())
self.frameWidgets.setSizePolicy(sizePolicy)
self.frameWidgets.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frameWidgets.setFrameShadow(QtWidgets.QFrame.Plain)
self.frameWidgets.setObjectName("frameWidgets")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.frameWidgets)
self.verticalLayout_3.setContentsMargins(5, 5, 5, 5)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayoutWidgets = QtWidgets.QVBoxLayout()
self.verticalLayoutWidgets.setObjectName("verticalLayoutWidgets")
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayoutWidgets.addItem(spacerItem1)
self.verticalLayout_3.addLayout(self.verticalLayoutWidgets)
self.horizontalLayout.addWidget(self.frameWidgets)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)