def __init__(self, title, parent=None): QFrame.__init__(self, parent) self.status = ComponentStatus.OFF self.titleLabel = QLabel(title) self.titleLabel.setAlignment(Qt.AlignCenter) self.statusLabel = QLabel("On" if self.status == ComponentStatus.ON else "Off") self.statusLabel.setAlignment(Qt.AlignCenter) self.vLayout = QVBoxLayout(self) self.vLayout.addWidget(self.titleLabel) self.vLayout.addWidget(self.statusLabel) self.vLayout.setAlignment(self.vLayout, Qt.AlignHCenter | Qt.AlignVCenter) self.setLayout(self.vLayout) self.opacityEffect = QGraphicsOpacityEffect(self) self.setObjectName("LedIndicatorFrame") self.setFrameStyle(QFrame.Box | QFrame.Panel) self.setStyleSheet( '#LedIndicatorFrame { border: 3px solid #FFFFFF; background-color: #304E6E; }' ) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self.deactivate()
def __init__(self, interface, search_header): QFrame.__init__(self) self.setObjectName("search-box") self.interface = interface self.search_header = search_header self.entree = QLineEdit() self.entree.returnPressed.connect(self.on_search) self.nb_res = QLabel() self.nb_res.setObjectName("search-result") self.nb_res.setAlignment(Qt.AlignCenter) self.restreint = QCheckBox("Se restreindre aux résulats courants") self.restreint.setToolTip("Ne cherche que dans les résultats affichés actuellement.") valid = QPushButton("Chercher") valid.setObjectName("round") valid.setToolTip("Lance une recherche sur tous les champs affichés.") valid.clicked.connect(self.on_search) retour = QPushButton("Annuler") retour.setObjectName("round") retour.setToolTip("Annule les résultats des recherches précédentes.") retour.clicked.connect(self.on_cancel) box = QGridLayout(self) box.addWidget(QLabel("Rechercher :"), 0, 0, 1, 2) box.addWidget(self.entree, 1, 0, 1, 2) box.addWidget(self.nb_res, 2, 0, 1, 2) box.addWidget(self.restreint, 3, 0, 1, 2) box.addWidget(valid, 4, 0) box.addWidget(retour, 4, 1)
def __init__(self, controller, *args, **kwargs): QFrame.__init__(self, *args, **kwargs) self.controller = controller self.controller.footer = self self.setFixedHeight(20) self.setStyleSheet('''background-color: #323232;''') # Layout layout = QHBoxLayout() layout.setSpacing(0) layout.setContentsMargins(3, 0, 2, 0) self.setLayout(layout) self.description_label = QLabel('') self.description_label.setStyleSheet(''' color: #808080; font-weight: 500;''') self.mode_label = QLabel('') self.mode_label.setStyleSheet(''' color: #808080; font-weight: 500;''') layout.addWidget(self.description_label, 1, Qt.AlignLeft) layout.addWidget(self.mode_label, 0, Qt.AlignRight) self.update_mode_label()
def __init__(self, p): QFrame.__init__(self, p) self.phs = 0 self.d_knbVolume = Knob("Volume", 0.0, 10.0, self) self.d_knbBalance = Knob("Balance", -10.0, 10.0, self) self.d_knbTreble = Knob("Treble", -10.0, 10.0, self) self.d_knbBass = Knob("Bass", -10.0, 10.0, self) self.d_thmLeft = Thermo("Left [dB]", self) self.d_thmRight = Thermo("Right [dB]", self) self.layout = QHBoxLayout(self) self.layout.setSpacing(0) #self.layout.setMargin( 10 ) self.layout.addWidget(self.d_knbVolume) self.layout.addWidget(self.d_knbBalance) self.layout.addWidget(self.d_knbTreble) self.layout.addWidget(self.d_knbBass) self.layout.addSpacing(20) self.layout.addStretch(10) self.layout.addWidget(self.d_thmLeft) self.layout.addSpacing(10) self.layout.addWidget(self.d_thmRight) self.d_knbVolume.setValue(7.0) self.startTimer(50) self.d_master = 0
def __init__(self, parent, display, tooltip, setting, max_): SingleLinkableSetting.__init__(self, setting) QFrame.__init__(self, parent) label = QLabel(self) label.setText(display) label.setToolTip(tooltip) self.label = label slider = QSlider(Qt.Horizontal) slider.setFocusPolicy(Qt.ClickFocus) slider.setRange(0, max_) slider.setValue(self.setting_value) self.slider = slider spinbox = QSpinBox() spinbox.setRange(0, max_) spinbox.setSingleStep(1) spinbox.setFixedWidth(120) spinbox.setValue(self.setting_value) spinbox.setAlignment(Qt.AlignCenter) self.spinbox = spinbox self.combined = WidgetCombiner(slider, spinbox, self) self.slider.valueChanged.connect(self.on_setting_changed_from_gui) self.spinbox.valueChanged.connect(self.on_setting_changed_from_gui) self.layout = QGridLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(label, 0, 0, 1, 1) self.layout.addItem(SPACER, 0, 1, 1, 1) self.layout.addWidget(self.combined, 0, 2, 1, 3) self.setLayout(self.layout)
def __init__(self, *args): # Invoke parent init QFrame.__init__(self, *args) self.item_id = None self.item_type = None # Get translation object _ = get_app()._tr # Widgets self.lblSelection = QLabel() self.lblSelection.setText("<strong>%s</strong>" % _("No Selection")) self.btnSelectionName = QPushButton() self.btnSelectionName.setVisible(False) self.btnSelectionName.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # Support rich text self.lblSelection.setTextFormat(Qt.RichText) hbox = QHBoxLayout() hbox.setContentsMargins(0,0,0,0) hbox.addWidget(self.lblSelection) hbox.addWidget(self.btnSelectionName) self.setLayout(hbox) # Connect signals get_app().window.propertyTableView.loadProperties.connect(self.select_item)
def __init__(self, parent): QFrame.__init__(self, parent) self.setFrameStyle(QFrame.Box | QFrame.Sunken) self.setStyleSheet("QListView{background:transparent;}") self.listView = QListView(self) self.setLayout(QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.listView) self.listView.setContextMenuPolicy(Qt.CustomContextMenu) self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers) self.listView.setMovement(QListView.Snap) self.listView.setFlow(QListView.LeftToRight) self.listView.setResizeMode(QListView.Adjust) self.listView.setGridSize( QSize(self.logicalDpiX() / 96 * 70, self.logicalDpiY() / 96 * 70)) self.listView.setViewMode(QListView.IconMode) self.quickDesktopModel = QuickDesktopModel( self.window().platform.databaseFile) self.listView.setModel(self.quickDesktopModel) self.createActions() self.makeConnections()
def __init__(self, parent): QFrame.__init__(self, parent) #self.setMinimumWidth(210) #self.setMinimumHeight(162) #self.setMaximumHeight(162) self.fRealParent = None self.fScene = None self.fRenderSource = QRectF(0.0, 0.0, 0.0, 0.0) self.fRenderTarget = QRectF(0.0, 0.0, 0.0, 0.0) self.fUseCustomPaint = False self.fFrameWidth = 0.0 self.fInitialX = 0.0 self.fInitialY = 0.0 self.fScale = 1.0 self.fViewBg = QColor(0, 0, 0) self.fViewBrush = QBrush(QColor(75, 75, 255, 30)) self.fViewPen = QPen(Qt.blue, 1) self.fViewRect = [3.0, 3.0, 10.0, 10.0] self.fMouseMode = MOUSE_MODE_NONE self.fMouseLeftDown = False self.fMouseRightDown = False self.fMousePos = None
def __init__(self, arFrame): QFrame.__init__(self, arFrame) self.arframe = arFrame self.initUI() self.loadWords()
def __init__(self, controller, *args, **kwargs): QFrame.__init__(self, *args, **kwargs) self.controller = controller self.is_mouse_pressed = False self.mouse_pos = (0, 0) self.setFixedHeight(30) self.setStyleSheet('''background-color: #323232;''') # Layout header_layout = QHBoxLayout() header_layout.setSpacing(0) header_layout.setContentsMargins(10, 0, 0, 0) self.setLayout(header_layout) title_label = QLabel('InstantGIS') title_label.setStyleSheet(''' color: #808080; font-weight: 500''') header_layout.addWidget(title_label, 1, Qt.AlignLeft) minimize_button = MinimizeButton(self) header_layout.addWidget(minimize_button, 0, Qt.AlignLeft) close_button = CloseButton(self) header_layout.addWidget(close_button, 0, Qt.AlignLeft)
def __init__(self, Filename, *args, **kwargs): QFrame.__init__(self, *args, **kwargs) # self.setMouseTracking(True) self.FileName = Filename self.Img = Img(self.FileName, self) _,name=os.path.split(self.FileName) self.Label = QLabel(name, self) self.Label.setWordWrap(False) self.scoller = MyScrollArea(self) self.scoller.setWidget(self.Img) self.scoller.setWidgetResizable(False) self.scoller.Changed_Signal.connect( self.Img.H_Refer_Line.Update_Appearance) self.scoller.Changed_Signal.connect( self.Img.V_Refer_Line.Update_Appearance) self.scoller.Changed_Signal.connect(self.Send_Sync_info) self.Img.Changed_Signal.connect(self.Send_Sync_info) self.Label.setAlignment(Qt.AlignHCenter) #self.Label.setMaximumHeight(30) hv = QVBoxLayout(self) hv.addWidget(self.Label) hv.addWidget(self.scoller)
def __init__(self, lbl='', min_freq_hz=0, max_freq_hz=6000000000, parent=None, thousands_separator=',', background_color='black', fontColor='white', click_callback=None): QFrame.__init__(self, parent) self.numberControl = DigitalNumberControl(min_freq_hz, max_freq_hz, self, thousands_separator, background_color, fontColor, click_callback) layout = QVBoxLayout() self.lbl = QLabel(lbl, self) if len: self.hasLabel = True layout.addWidget(self.lbl) else: self.hasLabel = False layout.addWidget(self.numberControl) layout.setAlignment(Qtc.AlignCenter | Qtc.AlignVCenter) self.setLayout(layout) self.show()
def __init__(self, ros_bridge): QFrame.__init__(self) self.ros_bridge = ros_bridge self.layout = QGridLayout(self) #plot widget self.locus_label = QLabel("航迹俯视图") self.locus_label.setAlignment(Qt.AlignCenter) self.plot_widget = pg.GraphicsLayoutWidget() self.locus_curve = pg.PlotCurveItem() self.locus_scatter = pg.ScatterPlotItem() self.locus_arrow = pg.PlotCurveItem() self.locus_plot = self.plot_widget.addPlot(row=0, col=0) self.locus_plot.setXRange(-30, 10) self.locus_plot.setYRange(-10, 30) self.locus_plot.setAspectLocked() self.locus_plot.showGrid(x=1, y=1) self.locus_plot.showAxis('right') self.locus_plot.showAxis('top') self.locus_plot.addItem(self.locus_curve) self.locus_plot.addItem(self.locus_scatter) self.locus_plot.addItem(self.locus_arrow) self.layout.addWidget(self.locus_label, 0, 0, 1, 1) self.layout.addWidget(self.plot_widget, 1, 0, 1, 1) self.locus_timer = QTimer() self.locus_timer.start(100) self.locus_timer.timeout.connect(self.update)
def __init__(self, bar, food, quantity): """Constructor""" QFrame.__init__(self) # Create the UI self.__init_UI(bar, food, quantity)
def __init__(self, store, invoker): QFrame.__init__(self) self.store = store self.invoker = invoker self.store.video_loaded_changed.connect(self._on_video_loaded_changed) self._init_ui()
def __init__(self, theParent, theProject): QFrame.__init__(self, theParent) logger.debug("Initialising DocDetails ...") self.mainConf = nw.CONFIG self.debugGUI = self.mainConf.debugGUI self.theParent = theParent self.theProject = theProject self.mainBox = QGridLayout(self) self.mainBox.setVerticalSpacing(1) self.mainBox.setHorizontalSpacing(15) self.setLayout(self.mainBox) self.fntOne = QFont() self.fntOne.setPointSize(10) self.fntOne.setBold(True) self.fntTwo = QFont() self.fntTwo.setPointSize(10) self.colTwo = [QLabel(""), QLabel(""), QLabel(""), QLabel("")] colOne = ["Name", "Status", "Class", "Layout"] for nRow in range(4): lblOne = QLabel(colOne[nRow]) lblOne.setFont(self.fntOne) self.mainBox.addWidget(lblOne, nRow, 0) self.mainBox.addWidget(self.colTwo[nRow], nRow, 1) self.mainBox.setColumnStretch(0, 0) self.mainBox.setColumnStretch(1, 1) logger.debug("DocDetails initialisation complete") return
def __init__(self, trueNode, astTools): """ This is the generic structure of the ast widgets. """ QFrame.__init__(self) # Bounding box stuff self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) # Set the layout self.layout = QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) # Add a dummy label for a line number to be added later self.line_number = QLabel() self.line_number.setText('#') self.line_number.setToolTip('Line Number(s)') self.layout.addWidget(self.line_number) # Run the bijective test every time the widget is created # print('BijectiveTest') self.nH_bijectiveTest(trueNode, astTools) # If the we are still going, the test passed, and a widget can be made from the trueNode # print('Real Thing') widget, terminals = self.nH_widgetBuilder(trueNode, astTools) # Add the widget to the layout self.layout.addWidget(widget) # Add the trueNode and terminals to the widget for use later self.node = trueNode self.terminals = terminals self.widget = widget
def __init__(self, parent=None): QFrame.__init__(self, parent) self.ui = Ui_frame_tab_queue() self.ui.setupUi(self) self.screen = parent self.listener = Listener(self.screen, self) self.connectSignals()
def __init__(self, parent=None, title=None, show_border=True): QFrame.__init__(self, parent) self.title = title self.console_comm = ConsoleComm() self.console_comm.text_signal.connect(self.process_text_signal) self.console_comm.msg_signal.connect(self.process_msg_signal) if show_border: self.setFrameStyle(QFrame.StyledPanel) self.text_area = QTextEdit(parent) self.text_area.setReadOnly(True) self.text_area.setLineWrapMode(QTextEdit.NoWrap) self.clear_button = QPushButton("Clear") self.clear_button.clicked.connect(self.click_clear) top_frame = QFrame() top_layout = QHBoxLayout() top_layout.setContentsMargins(0, 0, 0, 0) top_layout.addWidget(QLabel(title)) top_layout.addWidget(self.clear_button) top_frame.setLayout(top_layout) layout = QVBoxLayout() if not show_border: layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(top_frame) layout.addWidget(self.text_area) self.setLayout(layout)
def __init__(self, lbl='', onColor='green', offColor='red', initialState=False, maxSize=50, position=1, parent=None, callback=None, alignment=1, valignment=1): QFrame.__init__(self, parent) self.numberControl = ToggleSwitch(onColor, offColor, initialState, maxSize, parent, callback) if position < 3: layout = QVBoxLayout() else: layout = QHBoxLayout() self.lbl = lbl self.lblcontrol = QLabel(lbl, self) if position == 3: # left of switch self.lblcontrol.setAlignment(Qtc.AlignRight) elif position == 4: # right of switch self.lblcontrol.setAlignment(Qtc.AlignLeft) else: # Above or below self.lblcontrol.setAlignment(Qtc.AlignCenter) # add top or left if len(lbl) > 0: if position == 1 or position == 3: layout.addWidget(self.lblcontrol) layout.addWidget(self.numberControl) # Add bottom or right if len(lbl) > 0: if position == 2 or position == 4: layout.addWidget(self.lblcontrol) if alignment == 1: halign = Qtc.AlignCenter elif alignment == 2: halign = Qtc.AlignLeft else: halign = Qtc.AlignRight if valignment == 1: valign = Qtc.AlignVCenter elif valignment == 2: valign = Qtc.AlignTop else: valign = Qtc.AlignBottom layout.setAlignment(halign | valign) # layout.setAlignment(Qtc.AlignCenter | Qtc.AlignVCenter) self.setLayout(layout) textfont = self.lblcontrol.font() metrics = QFontMetricsF(textfont) maxWidth = max( (maxSize+4),(maxSize*2 + metrics.width(lbl)) ) maxHeight = max( (maxSize/2+4),(maxSize/2 + metrics.height()+2) ) #print('Min size: ' + str(maxWidth) + " x " + str(maxHeight)) self.setMinimumSize(int(maxWidth), int(maxHeight)) self.show()
def __init__(self, lbl='', parent=None, minimum=0, maximum=100, defaultvalue=0, backgroundColor='default', changedCallback=None, minsize=100, isFloat=False, scaleFactor=1, showvalue=False, outputmsgname='value'): QFrame.__init__(self, parent) self.numberControl = DialControl(minimum, maximum, defaultvalue, backgroundColor, self.valChanged, changedCallback, minsize) layout = QVBoxLayout() self.outputmsgname = outputmsgname self.showvalue = showvalue self.isFloat = isFloat self.scaleFactor = scaleFactor self.lbl = lbl self.lblcontrol = QLabel(lbl, self) self.lblcontrol.setAlignment(Qtc.AlignCenter) if self.showvalue: textstr = self.buildTextStr(defaultvalue*self.scaleFactor) self.lblcontrol.setText(textstr) if len or self.showvalue: self.hasLabel = True layout.addWidget(self.lblcontrol) else: self.hasLabel = False layout.addWidget(self.numberControl) layout.setAlignment(Qtc.AlignCenter) self.setLayout(layout) self.show()
def __init__(self, parent, picture_parameter: dict): QFrame.__init__(self, parent, flags=Qt.FramelessWindowHint) self.buffer = parent.buffer self.picture_parameter = picture_parameter self.picture_label = QLabel() self.resize_multiple = 1 scroll = QScrollArea(self) scroll.setWidget(self.picture_label) scroll.setObjectName('picture') self.name_combo = QComboBox(self) self.index_combo = QComboBox(self) self.palette_combo = QComboBox(self) self.resize_combo = QComboBox(self) self.name_combo.setFixedWidth(120) self.index_combo.setFixedWidth(120) self.palette_combo.setFixedWidth(120) self.resize_combo.setFixedWidth(120) self.name_combo.setItemDelegate(QStyledItemDelegate()) self.index_combo.setItemDelegate(QStyledItemDelegate()) self.palette_combo.setItemDelegate(QStyledItemDelegate()) self.resize_combo.setItemDelegate(QStyledItemDelegate()) self.resize_combo.addItems([f' × {i + 1}' for i in range(4)]) self.name_combo.currentTextChanged[str].connect(self.name_change) self.index_combo.currentIndexChanged.connect(self.refresh_data) self.palette_combo.currentIndexChanged.connect(self.refresh_data) self.resize_combo.currentIndexChanged.connect(self.refresh_data) self.name_combo.addItems(picture_parameter) output_button = QPushButton('導出圖片') input_button = QPushButton('導入圖片') output_button.clicked.connect(self.output_picture) input_button.clicked.connect(self.input_picture) control_layout = QVBoxLayout() control_layout.addWidget(QLabel('選擇圖片'), alignment=Qt.AlignLeft) control_layout.addWidget(self.name_combo, alignment=Qt.AlignRight) control_layout.addWidget(QLabel('選擇編號'), alignment=Qt.AlignLeft) control_layout.addWidget(self.index_combo, alignment=Qt.AlignRight) control_layout.addWidget(QLabel('選擇色板'), alignment=Qt.AlignLeft) control_layout.addWidget(self.palette_combo, alignment=Qt.AlignRight) control_layout.addWidget(QLabel('缩放比例'), alignment=Qt.AlignLeft) control_layout.addWidget(self.resize_combo, alignment=Qt.AlignRight) control_layout.addWidget(output_button, alignment=Qt.AlignRight) control_layout.addWidget(input_button, alignment=Qt.AlignRight) control_layout.addStretch() layout = QHBoxLayout() layout.addLayout(control_layout) layout.addWidget(scroll) self.setLayout(layout)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.memBox = QGroupBox("Memory Usage", self) self.memBox.setFont(QFont("Helvetica", 10)) self.memLayout = QVBoxLayout(self.memBox) #self.memLayout.setMargin( 15 ) self.memLayout.setSpacing(5) o = Qt.Horizontal self.memLayout.addWidget(ValueBar(o, "Used", self.memBox, 57)) self.memLayout.addWidget(ValueBar(o, "Shared", self.memBox, 17)) self.memLayout.addWidget(ValueBar(o, "Cache", self.memBox, 30)) self.memLayout.addWidget(ValueBar(o, "Buffers", self.memBox, 22)) self.memLayout.addWidget(ValueBar(o, "Swap Used", self.memBox, 57)) self.memLayout.addWidget(QWidget(self.memBox), 10) # spacer self.cpuBox = QGroupBox("Cpu Usage", self) self.cpuBox.setFont(QFont("Helvetica", 10)) self.cpuLayout = QHBoxLayout(self.cpuBox) self.cpuLayout.setContentsMargins(15, 15, 15, 15) self.cpuLayout.setSpacing(5) o = Qt.Vertical self.cpuLayout.addWidget(ValueBar(o, "User", self.cpuBox, 57)) self.cpuLayout.addWidget(ValueBar(o, "Total", self.cpuBox, 73)) self.cpuLayout.addWidget(ValueBar(o, "System", self.cpuBox, 16)) self.cpuLayout.addWidget(ValueBar(o, "Idle", self.cpuBox, 27)) self.layout = QHBoxLayout(self) self.layout.setContentsMargins(10, 10, 10, 10) self.layout.addWidget(self.memBox, 10) self.layout.addWidget(self.cpuBox, 0)
def __init__(self, parent=None, controller: SpaceHaulController = None, **kwargs): QFrame.__init__(self, parent, **kwargs) ThreadedObserver.__init__(self, **kwargs) self.controller = controller self.controller.star_list().add_observer(self) self.controller.ship_list().add_observer(self) self.star_add_comm = StarAddComm() self.star_add_comm.signal.connect(self.add_star) self.star_change_comm = StarChangeComm() self.star_change_comm.signal.connect(self.change_star) self.ship_add_comm = ShipAddComm() self.ship_add_comm.signal.connect(self.add_ship) self.ship_change_comm = ShipChangeComm() self.ship_change_comm.signal.connect(self.change_ship) # pixel sizes to force the gui to give us some space self.setMinimumWidth(500) self.setMinimumHeight(500) # center is the space coords (not gui) that the center of this gui centers on self.space_center_x = 0 self.space_center_y = 0 # width_ratio is the ratio of gui width to space width self.space_width_ratio = 1000 # save the rectangles that represent widgets self.star_rectangles: List[(Star, QRect)] = [] self.ship_rectangles: List[(Ship, QRect)] = [] self.setMouseTracking(True)
def __init__(self, *args): # Invoke parent init QFrame.__init__(self, *args) self.item_id = None self.item_type = None # Get translation object _ = get_app()._tr # Widgets self.lblSelection = QLabel() self.lblSelection.setText("<strong>%s</strong>" % _("No Selection")) self.btnSelectionName = QPushButton() self.btnSelectionName.setVisible(False) self.btnSelectionName.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # Support rich text self.lblSelection.setTextFormat(Qt.RichText) hbox = QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.lblSelection) hbox.addWidget(self.btnSelectionName) self.setLayout(hbox) # Connect signals get_app().window.propertyTableView.loadProperties.connect( self.select_item)
def __init__(self, text, id, state_changed_cb, disabled, checked): QFrame.__init__(self) self.id = id self.state_changed_cb = state_changed_cb self.disabled = disabled self.checked = checked self._init_ui(text)
def __init__(self, title='Untitled', parent_win=None, win_flag=None): if parent_win is not None and win_flag is None: win_flag = QtCore.Qt.Dialog QFrame.__init__(self) if parent_win is None else QFrame.__init__( self, parent_win, win_flag) # self.setObjectName(self.__class__.__name__) layout = QVBoxLayout() self.setLayout(layout) if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0, 0, 0, 0) else: layout.setMargin(0) self.title = title self.has_progress = False self._mainmenu = [] self._splitters = [] self._tabs = [] self._formset = None self._formLoaded = False self.uid = id(self) self.setAccessibleName('BaseWidget')
def __init__(self, label, paras_labels, style='QGrid', *args, **kwargs): QFrame.__init__(self, *args, **kwargs) if style == 'QGrid': Gd = QGridLayout(self) if style == 'QHBoxLayout': Gd = QHBoxLayout(self) if style == 'QVBoxLayout': Gd = QVBoxLayout(self) self.Label = QLabel(label, self) paras_labels = list(paras_labels) if style == 'QGrid': Gd.addWidget(self.Label, 0, 0, 2, 1) else: Gd.addWidget(self.Label) for i in paras_labels: self.__dict__.update({"Input_" + i: LabeledInPut(i, 10, self)}) lt = len(paras_labels) col = lt // 2 + 1 if lt % 2 else lt // 2 col = col + 1 for col in range(1, col): for row in range(0, 2): try: s = paras_labels.pop(0) l = eval("self.Input_" + s) if style == 'QGrid': Gd.addWidget(l, row, col) else: Gd.addWidget(l) except IndexError: print("Nothing") self.setLayout(Gd) self.Layout = Gd self.style_set() self.Signal_connection()
def __init__(self, parent, collapsed): QFrame.__init__(self, parent) self.setMaximumSize(24, 24) self.__hori = (QPointF(7, 8), QPointF(17, 8), QPointF(12, 13)) self.__vert = (QPointF(8, 7), QPointF(13, 12), QPointF(8, 17)) self._arrow = None self.set_arrow(int(collapsed))
def __init__(self, photoBaseDir, validPhotoFileExts, picChangeMs, parent=None): QFrame.__init__(self, parent) self.setStyleSheet("QTabWidget::pane { border: 0; }; background-color: 'black';") self.setLineWidth(0) self.setFrameShape(QtWidgets.QFrame.NoFrame) # self.setAlignment(Qt.AlignLeft | Qt.AlignTop) # Vars self.picChangeMs = picChangeMs self.photoBaseDir = photoBaseDir # # Widget # self.scene = QGraphicsScene() # self.setScene(self.scene) # self.setBackgroundBrush(QColor("black")) # self.setLineWidth(0) # self.setFrameShape(QtWidgets.QFrame.NoFrame) # Layout # layout = QVBoxLayout() # lbl = QTextEdit() # lbl.setReadOnly(True) # lbl.setLineWidth(0) # lbl.setFrameShape(QtWidgets.QFrame.NoFrame) # lbl.setStyleSheet('font: 30pt "Segoe UI"; color:"white"; background-color:"black"; QTabWidget::pane { border: 0; }') # lbl.setHtml("Hello") # layout.addWidget(lbl) # self.setLayout(layout) # Class vars self.picChgTimer = None self.photoFileManager = PhotoFileManager(validPhotoFileExts, self.photoBaseDir, 7200.00) self.photoFileManager.startPhotoListUpdate()
def __init__(self, parent, closeButton=True): QFrame.__init__(self, parent) self.setMaximumSize(QSize(9999999,22)) self.setObjectName("windowTitle") self.hboxlayout = QHBoxLayout(self) self.hboxlayout.setSpacing(0) self.hboxlayout.setContentsMargins(0,0,4,0) self.label = QLabel(self) self.label.setObjectName("label") self.label.setStyleSheet("padding-left:4px; font:bold 11px; color: #FFFFFF;") self.hboxlayout.addWidget(self.label) spacerItem = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem) if closeButton: self.pushButton = QPushButton(self) self.pushButton.setFocusPolicy(Qt.NoFocus) self.pushButton.setObjectName("pushButton") self.pushButton.setStyleSheet("font:bold;") self.pushButton.setText("X") self.hboxlayout.addWidget(self.pushButton) self.dragPosition = None self.mainwidget = self.parent() self.setStyleSheet(""" QFrame#windowTitle {background-color:#222222;color:#FFF;} """) # Initial position to top left self.dragPosition = self.mainwidget.frameGeometry().topLeft()
def __init__(self, list_widget, list_widget_item, client): QFrame.__init__(self) self.ui = ui.preview_client_slot.Ui_ClientSlotWidget() self.ui.setupUi(self) self.client = client self._list_widget = list_widget self._list_widget_item = list_widget_item self._icon_on = QIcon() self._icon_off = QIcon() self.ui.actionAddToTheCurrentSession.triggered.connect( self._add_to_the_current_session) self.ui.actionProperties.triggered.connect(self._properties_request) self._menu = QMenu(self) self._menu.addAction(self.ui.actionAddToTheCurrentSession) self._menu.addAction(self.ui.actionProperties) self.ui.iconButton.setMenu(self._menu) dark = is_dark_theme(self) self.update_client_data() self._server_status = ray.ServerStatus.OFF
def __init__(self, theParent): QFrame.__init__(self, theParent) logger.debug("Initialising NoticeBar ...") self.mainConf = nw.CONFIG self.theParent = theParent self.theTheme = theParent.theTheme self.setContentsMargins(0,0,0,0) self.setFrameShape(QFrame.Box) self.mainBox = QHBoxLayout(self) self.mainBox.setContentsMargins(8,2,2,2) self.noteLabel = QLabel("Hi there!") self.closeButton = QPushButton(self.theTheme.getIcon("close"),"") self.closeButton.clicked.connect(self.hideNote) self.mainBox.addWidget(self.noteLabel) self.mainBox.addWidget(self.closeButton) self.mainBox.setStretch(0, 1) self.setLayout(self.mainBox) self.hideNote() logger.debug("NoticeBar initialisation complete") return
def __init__(self, ficheroMapeta, canvas, pare=None, mapeta_default=None): QFrame.__init__(self) self.canvas = canvas self.setParent(pare) self.pare = pare # self.colorMarca= QColor(121,144,155) self.colorMarcas = QColor(255, 90, 14) self.mapeta_default = mapeta_default self.setDropable() self.ficheroMapeta = ficheroMapeta # leer info del mapeta datos_mapeta = self.CalcularPNGyRangoMapeta(ficheroMapeta) # inicialmente ancho (y alto) ancho_mapeta = datos_mapeta[5] self.radio = ancho_mapeta # print("ancho_mapeta", ancho_mapeta) # calcular el margen self.margen = ancho_mapeta / 7 ancho_mapetaBrujulado = ancho_mapeta + self.margen * 2 # dimensionar mapeta brujulado a ancho+margen self.setGeometry(0, 0, ancho_mapetaBrujulado, ancho_mapetaBrujulado) self.setMinimumSize(QSize(ancho_mapetaBrujulado, ancho_mapetaBrujulado)) self.setMaximumSize(QSize(ancho_mapetaBrujulado, ancho_mapetaBrujulado)) self.setWindowTitle('MapetaBrujulado') self.qvCompass = QvCompass(self.canvas, pare=self) self.qvCompass.setGeometry(0, 0, ancho_mapetaBrujulado, ancho_mapetaBrujulado) self.qvCompass.colorMarcasCompass = self.colorMarcas self.qvCompass.show() self.qvMapeta = QvMapeta(self.canvas, ficheroMapeta, pare=self.qvCompass) self.qvMapeta.colorMarcasMapeta = self.colorMarcas self.qvMapeta.show() # relaciono mapeta y compas. Mapeta dentro de compass self.lContenidoCompass = QHBoxLayout() self.lContenidoCompass.setContentsMargins(self.margen, self.margen, self.margen, self.margen) self.lContenidoCompass.addWidget(self.qvMapeta) try: self.qvCompass.setLayout(self.lContenidoCompass) except Exception as ee: pass # print(str(ee)) #relaciono compass mapeta brujulado. Compass dentro mapetaBrujulado self.lcontenidoMapetaBrujulado = QHBoxLayout() self.lcontenidoMapetaBrujulado.setContentsMargins(0, 0, 0, 0) self.lcontenidoMapetaBrujulado.addWidget(self.qvCompass) self.setLayout(self.lcontenidoMapetaBrujulado) # Desde clase contenedora hago que self.qvMapeta.Sig_dadoPNT.connect(self.EnviarPNTCompass)
def __init__(self, text='Year:', min_year=1950, max_year=2100, **kwargs): QFrame.__init__(self) self.main_layout = QHBoxLayout(self) self.label = QLabel(text) self.year_selector = QSpinBox() self.year_selector.setRange(min_year, max_year) self.main_layout.addWidget(self.label) self.main_layout.addWidget(self.year_selector)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.original_parent = parent self.palette = self.palette() self.palette.setColor(QPalette.Window, QColor(0,0,0)) self.setPalette(self.palette) self.setAutoFillBackground(True)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.ui = Ui_frame_tab_video() self.ui.setupUi(self) self.screen = parent self.listener = Listener(parent, self) self.connectSignals() interface.tab_video.fillElementsFromConfig(self, self.screen.config)
def __init__(self, text): QFrame.__init__(self, text) self.grid_scroll_area = PyQtExtras.GridScrollArea(self) self.text = text self.child_set = dict() self.setAcceptDrops(True)
def __init__(self, parentWidget): QFrame.__init__(self, parentWidget, Qt.Tool ) layout = QHBoxLayout() self.setWindowTitle('Edit URL reference') self.setLayout(layout) self.editLine = QLineEdit(self) layout.addWidget(self.editLine) applyButton = QPushButton('Apply') applyButton.clicked.connect(self.doApply) layout.addWidget(applyButton)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.ui = Ui_frame_tab_gif() self.ui.setupUi(self) self.screen = parent self.formatter = CommandFormatter(self.ui.line_console, self.screen) self.listener = Listener(self.screen, self, self.formatter) self.connectSlots() interface.tab_gif.addCustomWidgets(self) interface.tab_gif.fillElementsFromConfig(self, self.screen.config) self.ui.group_advsettings.setDisabled(True) self.ui.line_console.hide()
def __init__(self, parent): QFrame.__init__(self, parent) self.textpad = QPlainTextEdit(self) self.setLayout(QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.textpad) self.setFrameStyle(QFrame.Box | QFrame.Sunken) self.setStyleSheet("QPlainTextEdit{background:transparent;}") settings = self.window().platform.getSettings() text = settings.value("textpad", "") self.textpad.setPlainText(text)
def __init__(self, name, args, parent, io=False): QFrame.__init__(self, parent) self._model = StepArgsModel(self, io) self._args = args self._name = name self._offset = QtCore.QPoint() self._inputs = {} self._outputs = {} self._selected = False self.inut_ui(name, args) self._set_style()
def __init__(self, parent=None, text=None, EditorSidebarClass=EditorSidebar, EditorViewClass=EditorView): QFrame.__init__(self, parent) self.view = EditorViewClass(self, text) self.sidebar = EditorSidebarClass(self) self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.setLineWidth(2) self.vlayout = QVBoxLayout() self.vlayout.setSpacing(0) self.setLayout(self.vlayout) self.hlayout = QHBoxLayout() self.vlayout.addLayout(self.hlayout) self.hlayout.addWidget(self.sidebar) self.hlayout.addWidget(self.view) self.vlayout.setContentsMargins(2, 2, 2, 2)
def __init__(self, parent, label_text, send_to_other=None, other=None): QFrame.__init__(self) self.parent = parent self.send_to_other = send_to_other self.other = other self.input_dir = None # Create the GUI widgets self.main_layout = QHBoxLayout(self) self.label = QLabel(label_text) self.dir_entry = QLineEdit() self.browse_button = PyQtExtras.CommandButton('Browse') self.browse_button.set_handler(self.on_browse) self.main_layout.addWidget(self.label) self.main_layout.addWidget(self.dir_entry) self.main_layout.addWidget(self.browse_button)
def __init__(self, parent): QFrame.__init__(self, parent) self.timer = QBasicTimer() self.isWaitingAfterLine = False self.curPiece = Shape() self.nextPiece = Shape() self.curX = 0 self.curY = 0 self.numLinesRemoved = 0 self.board = [] self.setFocusPolicy(Qt.StrongFocus) self.isStarted = False self.isPaused = False self.clearBoard() self.nextPiece.setRandomShape() self._parent = parent
def __init__(self, root, nprocs, dst_dir): ''' Inputs: root : Root window to place frame in nprocs : Number of process running simultaneously dst_dir : The output directory for all files ''' QFrame.__init__(self); self.tRemain = timedelta(seconds = -1.0); self.refTime = None; self.bars = [None] * nprocs; # List for track progress bar instances self.thread = None; # Attribute to store thread handle for time remaining updater self.getLock = Lock(); # Threading lock, used in freeBar self.freeLock = Lock(); self._n = -1; # Number of tracks converted self._m = 0; # Number of tracks to convert outLabel = QLabel( 'Output: {}'.format(dst_dir) ); # Label for the output directory progLabel = QLabel( 'Overall Progress'); # Label for the progress bar tRemainSTR = QLabel( '' ) # tkinter string variable for the time remaining tElapsSTR = QLabel( '' ); self.tRemainSTR.connect( tRemainSTR.setText ) self.tElapsSTR.connect( tElapsSTR.setText ) self.progress = QProgressBar( ); # Progress bar self.progress.setValue( 0 ); # Initialize value to zero (0) self.progressMax.connect( self.progress.setMaximum ); self.progressUpdate.connect( self.progress.setValue ); self.layout = QVBoxLayout(); self.layout.setSpacing(2); self.layout.addWidget( outLabel ); # Pack the output dir label self.layout.addWidget( progLabel ); # Pack the progress bar label self.layout.addWidget( self.progress ); # Pack the progress bar self.layout.addWidget( tRemainSTR ); # Pack label for time remaining self.layout.addWidget( tElapsSTR ); # Pack label for time remaining self._addProgress( nprocs ); # Create all track progress bar instances self.setLayout( self.layout ) self.show();
def __init__(self, parent, title): QFrame.__init__(self, parent) self.setFrameStyle(QFrame.StyledPanel) titleLabel = QLabel(title, self) contentPanel = QWidget(self) contentPanel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.MinimumExpanding) self.contentLayout = QHBoxLayout() self.contentLayout.setContentsMargins(0, 0, 0, 0) contentPanel.setLayout(self.contentLayout) # style for the label titleLabel.setStyleSheet('''.QLabel { color: #3E6AAA; }''') # style for the content panel contentPanel.setStyleSheet('''.QWidget { border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; background-color: #D6E5F3; }''') # style for the whole toolbar self.setStyleSheet('''TitledToolbar { background-color:#C1D9F1; color:#6D6AB7; border-radius: 5px; border-style: solid; border-width: 1px; border-color: #6D6AB7; }''') myLayout = QVBoxLayout() myLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(myLayout) myLayout.addWidget(titleLabel, 0, Qt.AlignHCenter | Qt.AlignTop) myLayout.addWidget(contentPanel)
def __init__(self, root, orient = None, mode = None): QFrame.__init__(self); self.time = None; # Initialize variable for computation time self.running = False; # Set running to False artist = QLabel('Artist:'); # Set up label for track artist album = QLabel('Album:'); # Set up label for track album track = QLabel('Track:'); # Set up label for track name self.artistLabel = QLabel(''); # Set label to display track artist using the artist tkinter string var self.albumLabel = QLabel(''); # Set label to display album artist using the album tkinter string var self.trackLabel = QLabel(''); # Set label to display track name using the track tkinter string var self.artist.connect(self.artistLabel.setText) self.album.connect(self.albumLabel.setText) self.track.connect(self.trackLabel.setText); self.progress = QProgressBar(); # Initialize track progress bar self.progress.setMaximum(self.maxVal); # Set maximum value of the track progress bar self.progressUpdate.connect( self.progress.setValue ); status = QLabel(''); # Set up label for status self.status.connect(status.setText); layout = QGridLayout(); layout.setColumnStretch(1, 1); layout.addWidget(artist, 0, 0, 1, 1); layout.addWidget(self.artistLabel, 0, 1, 1, 1); layout.addWidget(album, 1, 0, 1, 1); layout.addWidget(self.albumLabel, 1, 1, 1, 1); layout.addWidget(track, 2, 0, 1, 1); layout.addWidget(self.trackLabel, 2, 1, 1, 1); layout.addWidget(self.progress, 3, 0, 1, 2); layout.addWidget(status, 4, 0, 1, 2); layout.setVerticalSpacing(2); self.setLayout( layout ); self.show(); self.__labelWidth = round( self.progress.width() * 0.75 ); # Get width of progress bar after everything is packed
def __init__(self, parent): QFrame.__init__(self, parent) self.setFrameStyle(QFrame.Box | QFrame.Sunken) self.setStyleSheet("QListView{background:transparent;}") self.listView = QListView(self) self.setLayout(QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.listView) self.listView.setContextMenuPolicy(Qt.CustomContextMenu) self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers) self.listView.setMovement(QListView.Snap) self.listView.setFlow(QListView.LeftToRight) self.listView.setResizeMode(QListView.Adjust) self.listView.setGridSize(QSize(self.logicalDpiX() / 96 * 70, self.logicalDpiY() / 96 * 70)) self.listView.setViewMode(QListView.IconMode) self.quickDesktopModel = QuickDesktopModel(self.window().platform.databaseFile) self.listView.setModel(self.quickDesktopModel) self.createActions() self.makeConnections()
def __init__(self, parent=None): QFrame.__init__(self, parent) # Création des éléments # Label label = QLabel("Options", self) label.setAlignment(Qt.AlignHCenter) # Check Box self.permanentCB = QCheckBox("Permanent", self) self.permanentCB.stateChanged.connect(self._setPermanent) # Layouts vbox = QVBoxLayout() vbox.addWidget(label) vbox.addWidget(self.permanentCB) # Création des variables self.permanent = False # Affichage de l'interface self.setLayout(vbox) self.setFrameShape(6)
def __init__(self, parent): QFrame.__init__(self, parent) self.fUseCustomPaint = False self.fMouseDown = False self.fViewBg = QColor(0, 0, 0) self.fViewBrush = QBrush(QColor(75, 75, 255, 30)) self.fViewPen = QPen(Qt.blue, 1) self.fScale = 1.0 self.fScene = None self.fRealParent = None self.fFakeWidth = 0.0 self.fFakeHeight = 0.0 self.fRenderSource = self.getRenderSource() self.fRenderTarget = QRectF(0, 0, 0, 0) self.fViewPadX = 0.0 self.fViewPadY = 0.0 self.fViewRect = [0.0, 0.0, 10.0, 10.0]
def __init__(self, parent): QFrame.__init__(self, parent) #self.setMinimumWidth(210) #self.setMinimumHeight(162) #self.setMaximumHeight(162) self.fRealParent = None self.fScene = None self.fRenderSource = QRectF(0.0, 0.0, 0.0, 0.0) self.fRenderTarget = QRectF(0.0, 0.0, 0.0, 0.0) self.fUseCustomPaint = False self.fInitialX = 0.0 self.fScale = 1.0 self.fViewBg = QColor(0, 0, 0) self.fViewBrush = QBrush(QColor(75, 75, 255, 30)) self.fViewPen = QPen(Qt.blue, 1) self.fViewRect = [3.0, 3.0, 10.0, 10.0] self.fMouseDown = False
def __init__(self, plot_title, finish_creating_plot_gui, is_top_level): QFrame.__init__(self) self.setWindowTitle(plot_title) self.main_layout = QVBoxLayout(self) self.splitter = QSplitter() self.dnd_frame_1 = DndFrame('Output Graphs') self.dnd_frame_2 = DndFrame('Graphs to Display') self.splitter.addWidget(self.dnd_frame_1) self.splitter.addWidget(self.dnd_frame_2) self.main_layout.addWidget(self.splitter) self.button_layout = QHBoxLayout() self.dnd_close_button = PyQtExtras.CommandButton('Close') self.dnd_close_button.set_handler(self.on_close) self.dnd_accept_button = PyQtExtras.CommandButton('Accept') self.dnd_accept_button.set_handler(self.on_accept) self.button_layout.addWidget(self.dnd_close_button) self.button_layout.addWidget(self.dnd_accept_button) self.button_layout.setAlignment(Qt.AlignRight) self.main_layout.addLayout(self.button_layout) self.finish_creating_plot_gui = finish_creating_plot_gui self.is_top_level = is_top_level self.setMinimumSize(QSize(800, 640))
def __init__(self, *args): # Invoke parent init QFrame.__init__(self, *args) self.item_id = None self.item_type = None # Get translation object _ = get_app()._tr # Widgets self.lblSelection = QLabel() self.lblSelection.setText("<strong>%s</strong>" % _("No Selection")) self.btnSelectionName = QPushButton() self.btnSelectionName.setVisible(False) self.btnSelectionName.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # Support rich text self.lblSelection.setTextFormat(Qt.RichText) hbox = QHBoxLayout() hbox.setContentsMargins(0,0,0,0) hbox.addWidget(self.lblSelection) hbox.addWidget(self.btnSelectionName) self.setLayout(hbox) # Timer to use a delay before showing properties (to prevent a mass selection from trying # to update the property model hundreds of times) self.update_timer = QTimer() self.update_timer.setInterval(100) self.update_timer.timeout.connect(self.update_item_timeout) self.update_timer.stop() self.next_item_id = None self.next_item_type = None # Connect signals get_app().window.propertyTableView.loadProperties.connect(self.select_item)
def __init__(self, *args, **kwargs): QFrame.__init__(self, *args, **kwargs) self.setLineWidth(1) self.setMidLineWidth(0) self.setOrientation(Qt.Horizontal)
def __init__(self, parent): QFrame.__init__(self, parent) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.setFrameShape(QFrame.HLine) self.setFrameShadow(QFrame.Sunken)
def __init__(self, parent): QFrame.__init__(self, parent) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.widgets = [] self.previousSize = None
def __init__(self, plugin): QFrame.__init__(self, core.workspace()) self._mode = None self.plugin = plugin uic.loadUi(os.path.join(os.path.dirname(__file__), 'SearchWidget.ui'), self) self.cbSearch.setCompleter(None) self.cbReplace.setCompleter(None) self.cbMask.setCompleter(None) self.fsModel = QDirModel(self.cbPath.lineEdit()) self.fsModel.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot) self.cbPath.lineEdit().setCompleter(QCompleter(self.fsModel, self.cbPath.lineEdit())) self._pathBackspaceShortcut = QShortcut(QKeySequence("Ctrl+Backspace"), self.cbPath, self._onPathBackspace) self._pathBackspaceShortcut.setContext(Qt.WidgetWithChildrenShortcut) # TODO QDirModel is deprecated but QCompleter does not yet handle # QFileSystemodel - please update when possible.""" self.cbSearch.setCompleter(None) self.pbSearchStop.setVisible(False) self.pbReplaceCheckedStop.setVisible(False) self._progress = QProgressBar(self) self._progress.setAlignment(Qt.AlignCenter) self._progress.setToolTip(self.tr("Search in progress...")) self._progress.setMaximumSize(QSize(80, 16)) core.mainWindow().statusBar().insertPermanentWidget(1, self._progress) self._progress.setVisible(False) # cd up action self.tbCdUp = QToolButton(self.cbPath.lineEdit()) self.tbCdUp.setIcon(QIcon(":/enkiicons/go-up.png")) self.tbCdUp.setCursor(Qt.ArrowCursor) self.tbCdUp.installEventFilter(self) # for drawing button self.cbSearch.installEventFilter(self) # for catching Tab and Shift+Tab self.cbReplace.installEventFilter(self) # for catching Tab and Shift+Tab self.cbPath.installEventFilter(self) # for catching Tab and Shift+Tab self.cbMask.installEventFilter(self) # for catching Tab and Shift+Tab self._closeShortcut = QShortcut(QKeySequence("Esc"), self) self._closeShortcut.setContext(Qt.WidgetWithChildrenShortcut) self._closeShortcut.activated.connect(self.hide) # connections self.cbSearch.lineEdit().textChanged.connect(self._onSearchRegExpChanged) self.cbSearch.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbReplace.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbPath.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbMask.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbRegularExpression.stateChanged.connect(self._onSearchRegExpChanged) self.cbCaseSensitive.stateChanged.connect(self._onSearchRegExpChanged) self.cbWholeWord.stateChanged.connect(self._onSearchRegExpChanged) self.tbCdUp.clicked.connect(self._onCdUpPressed) self.pbNext.pressed.connect(self.searchNext) self.pbPrevious.pressed.connect(self.searchPrevious) self.pbSearchStop.pressed.connect(self.searchInDirectoryStopPressed) self.pbReplaceCheckedStop.pressed.connect(self.replaceCheckedStopPressed) core.mainWindow().hideAllWindows.connect(self.hide) core.workspace().escPressed.connect(self.hide) core.workspace().currentDocumentChanged.connect( lambda old, new: self.setVisible(self.isVisible() and new is not None))
def __init__(self, parent, host, doSetup = True, onlyPatchbay = True, is3D = False): QFrame.__init__(self, parent) self.host = host if False: # kdevelop likes this :) host = CarlaHostMeta() self.host = host # ------------------------------------------------------------- self.fLayout = QGridLayout(self) self.fLayout.setContentsMargins(0, 0, 0, 0) self.fLayout.setSpacing(1) self.setLayout(self.fLayout) self.fView = QGraphicsView(self) self.fKeys = PixmapKeyboardHArea(self) self.fPeaksIn = DigitalPeakMeter(self) self.fPeaksOut = DigitalPeakMeter(self) self.fPeaksCleared = True self.fPeaksIn.setColor(DigitalPeakMeter.BLUE) self.fPeaksIn.setChannels(2) self.fPeaksIn.setOrientation(DigitalPeakMeter.VERTICAL) self.fPeaksIn.setFixedWidth(25) self.fPeaksOut.setColor(DigitalPeakMeter.GREEN) self.fPeaksOut.setChannels(2) self.fPeaksOut.setOrientation(DigitalPeakMeter.VERTICAL) self.fPeaksOut.setFixedWidth(25) self.fLayout.addWidget(self.fPeaksIn, 0, 0) self.fLayout.addWidget(self.fView, 0, 1) # self.fViewWidget if is3D else self.fLayout.addWidget(self.fPeaksOut, 0, 2) self.fLayout.addWidget(self.fKeys, 1, 0, 1, 0) # ------------------------------------------------------------- # Internal stuff self.fParent = parent self.fPluginCount = 0 self.fPluginList = [] self.fExternalPatchbay = False self.fIsOnlyPatchbay = onlyPatchbay self.fSelectedPlugins = [] self.fCanvasWidth = 0 self.fCanvasHeight = 0 # ------------------------------------------------------------- # Set-up Canvas Preview self.fMiniCanvasPreview = self.fParent.ui.miniCanvasPreview self.fMiniCanvasPreview.setRealParent(self) self.fMovingViaMiniCanvas = False # ------------------------------------------------------------- # Set-up Canvas self.scene = patchcanvas.PatchScene(self, self.fView) self.fView.setScene(self.scene) self.fView.setRenderHint(QPainter.Antialiasing, bool(parent.fSavedSettings[CARLA_KEY_CANVAS_ANTIALIASING] == patchcanvas.ANTIALIASING_FULL)) if parent.fSavedSettings[CARLA_KEY_CANVAS_USE_OPENGL] and hasGL: # and not is3D: self.fViewWidget = QGLWidget(self) self.fView.setViewport(self.fViewWidget) self.fView.setRenderHint(QPainter.HighQualityAntialiasing, parent.fSavedSettings[CARLA_KEY_CANVAS_HQ_ANTIALIASING]) self.setupCanvas() QTimer.singleShot(100, self.slot_restoreScrollbarValues) # ------------------------------------------------------------- # Connect actions to functions parent.ui.act_settings_show_meters.toggled.connect(self.slot_showCanvasMeters) parent.ui.act_settings_show_keyboard.toggled.connect(self.slot_showCanvasKeyboard) self.fView.horizontalScrollBar().valueChanged.connect(self.slot_horizontalScrollBarChanged) self.fView.verticalScrollBar().valueChanged.connect(self.slot_verticalScrollBarChanged) self.scene.scaleChanged.connect(self.slot_canvasScaleChanged) self.scene.sceneGroupMoved.connect(self.slot_canvasItemMoved) self.scene.pluginSelected.connect(self.slot_canvasPluginSelected) self.fMiniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved) self.fKeys.keyboard.noteOn.connect(self.slot_noteOn) self.fKeys.keyboard.noteOff.connect(self.slot_noteOff) # ------------------------------------------------------------- # Load Settings settings = QSettings() showMeters = settings.value("ShowMeters", False, type=bool) self.fParent.ui.act_settings_show_meters.setChecked(showMeters) self.fPeaksIn.setVisible(showMeters) self.fPeaksOut.setVisible(showMeters) showKeyboard = settings.value("ShowKeyboard", not(MACOS or WINDOWS), type=bool) self.fParent.ui.act_settings_show_keyboard.setChecked(showKeyboard) self.fKeys.setVisible(showKeyboard) # ------------------------------------------------------------- # Connect actions to functions (part 2) host.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback) host.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback) host.NoteOnCallback.connect(self.slot_handleNoteOnCallback) host.NoteOffCallback.connect(self.slot_handleNoteOffCallback) host.PatchbayClientAddedCallback.connect(self.slot_handlePatchbayClientAddedCallback) host.PatchbayClientRemovedCallback.connect(self.slot_handlePatchbayClientRemovedCallback) host.PatchbayClientRenamedCallback.connect(self.slot_handlePatchbayClientRenamedCallback) host.PatchbayClientDataChangedCallback.connect(self.slot_handlePatchbayClientDataChangedCallback) host.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback) host.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback) host.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback) host.PatchbayConnectionAddedCallback.connect(self.slot_handlePatchbayConnectionAddedCallback) host.PatchbayConnectionRemovedCallback.connect(self.slot_handlePatchbayConnectionRemovedCallback) if not doSetup: return parent.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable) parent.ui.act_plugins_disable.triggered.connect(self.slot_pluginsDisable) parent.ui.act_plugins_volume100.triggered.connect(self.slot_pluginsVolume100) parent.ui.act_plugins_mute.triggered.connect(self.slot_pluginsMute) parent.ui.act_plugins_wet100.triggered.connect(self.slot_pluginsWet100) parent.ui.act_plugins_bypass.triggered.connect(self.slot_pluginsBypass) parent.ui.act_plugins_center.triggered.connect(self.slot_pluginsCenter) parent.ui.act_plugins_panic.triggered.connect(self.slot_pluginsDisable) parent.ui.act_canvas_show_internal.triggered.connect(self.slot_canvasShowInternal) parent.ui.act_canvas_show_external.triggered.connect(self.slot_canvasShowExternal) parent.ui.act_canvas_arrange.setEnabled(False) # TODO, later parent.ui.act_canvas_arrange.triggered.connect(self.slot_canvasArrange) parent.ui.act_canvas_refresh.triggered.connect(self.slot_canvasRefresh) parent.ui.act_canvas_zoom_fit.triggered.connect(self.slot_canvasZoomFit) parent.ui.act_canvas_zoom_in.triggered.connect(self.slot_canvasZoomIn) parent.ui.act_canvas_zoom_out.triggered.connect(self.slot_canvasZoomOut) parent.ui.act_canvas_zoom_100.triggered.connect(self.slot_canvasZoomReset) parent.ui.act_canvas_print.triggered.connect(self.slot_canvasPrint) parent.ui.act_canvas_save_image.triggered.connect(self.slot_canvasSaveImage) parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)