Exemple #1
0
    def set_up_areas(self):
        self.content_layout.addWidget(self.user_area)
        self.content_layout.addWidget(self.chat_area)
        self.content_layout.setSpacing(10)

        self.user_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)

        users_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        users_layout.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.user_content.setLayout(users_layout)
        self.user_content.setObjectName("user_content")

        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(1)

        self.user_area.setSizePolicy(size_policy)

        self.chat_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.chat_area.verticalScrollBar().rangeChanged.connect(self.move_bar)

        chat_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.BottomToTop)
        chat_layout.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeft)
        self.chat_content.setLayout(chat_layout)
        self.chat_content.setObjectName("chat_content")

        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(4)
        self.chat_area.setSizePolicy(size_policy)
Exemple #2
0
	def __init__(self, parent=None, direction=QtWidgets.QBoxLayout.LeftToRight, collapsed=False):
		QtWidgets.QFrame.__init__(self, parent)
		self.direction = direction
		self.collapsed = collapsed

		self.layout = QtWidgets.QBoxLayout(direction)
		self.layout.setSpacing(0)
		self.layout.setContentsMargins(0, 0, 0, 0)
		self.box_frame = QtWidgets.QFrame()
		self.box_frame.setObjectName("collapsable_frame")
		self.box_layout = QtWidgets.QBoxLayout(direction)
		self.box_layout.setSpacing(2)
		self.box_layout.setContentsMargins(2, 2, 2, 2)
		self.box_frame.setLayout(self.box_layout)

		self.button_min = QtWidgets.QPushButton()
		self.button_min.setMinimumWidth(10)
		self.button_min.setMinimumHeight(10)
		self.button_min.setSizePolicy(QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum))
		self.button_min.setObjectName("btn_min")
		self.button_min.clicked.connect(self.switchState)

		self.layout.addWidget(self.button_min)
		self.layout.addWidget(self.box_frame)
		self.layout.setStretch(0, 0)
		self.layout.setStretch(1, 1)
		self.setLayout(self.layout)
		self.setArrow()

		if direction == QtWidgets.QBoxLayout.LeftToRight:
			self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
		else:
			self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)

		self.setObjectName("collapsable")
    def layout_init(self):
        self.pvbox = QtWidgets.QVBoxLayout()
        self.buttongroup = QtWidgets.QButtonGroup(self)
        for elements, forms in enumerate(self.operator):
            element = str(forms)
            self.partners = QtWidgets.QRadioButton(element)
            self.buttongroup.addButton(self.partners, elements)
            self.pvbox.addWidget(self.partners, )
            if elements == 0:
                self.partners.setChecked(True)
                self.element = self.partners.text()
        self.buttongroup.buttonClicked.connect(self.on_item_selected)
        self.buttongroup.buttonClicked['int'].connect(self.on_item_selected)

        self.variants = QtWidgets.QComboBox()
        for elements, forms in enumerate(self.variant):
            element = str(forms)
            self.variants.addItem(element)
        self.variants.model().item(0).setEnabled(False)
        self.variants.activated.connect(self.update_textbox)

        self.textbox = QtWidgets.QLineEdit()

        self.tablewidget = QtWidgets.QTableView()
        self.tablewidget.setSortingEnabled(True)

        self.pb = QtWidgets.QPushButton(self.tr('Run process'))
        self.pb.setDisabled(True)
        self.textbox.textChanged.connect(self.disable_button)
        self.pb.clicked.connect(self.on_clicked_pb)
        self.clearbutton = QtWidgets.QPushButton(self.tr('Clear all'))
        self.clearbutton.setDisabled(True)
        self.clearbutton.clicked.connect(self.on_clicked_clear)

        vgroupbox = QtWidgets.QGroupBox('Options')
        pgroupbox = QtWidgets.QGroupBox('Partner')

        mainpanel = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        self.variantpanel = QtWidgets.QBoxLayout(
            QtWidgets.QBoxLayout.TopToBottom)
        self.variantpanel.addWidget(self.variants)
        self.variantpanel.addWidget(self.textbox)
        self.variantpanel.addWidget(self.clearbutton)
        self.variantpanel.addWidget(self.pb)
        mainpanel.addWidget(pgroupbox)
        mainpanel.addWidget(vgroupbox)
        vgroupbox.setLayout(self.variantpanel)
        test = QtWidgets.QVBoxLayout(self)
        test.addLayout(self.pvbox)
        pgroupbox.setLayout(test)

        grid = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom, self)
        grid.addLayout(self.create_layout_label())
        grid.addLayout(mainpanel)
        grid.addWidget(self.tablewidget)
        self.setLayout(grid)
Exemple #4
0
    def create(self):
        self.v_layout = QtWidgets.QGridLayout(self.central)
        self.v_layout.setContentsMargins(0, 0, 0, 0)
        self.v_layout.setSpacing(0)

        self.tab_panel = self.panel()
        self.v_layout.addWidget(self.tab_panel, 0, 0)
        self.v_layout.setRowStretch(0, 0)

        self.tab_layout = QtWidgets.QGridLayout(self.tab_panel)
        self.tab_layout.setContentsMargins(0, 0, 0, 0)
        self.tabs = qtgui.Tabs()
        self.tab_layout.addWidget(self.tabs)

        self.h_layout = QtWidgets.QGridLayout()
        self.h_layout.setContentsMargins(0, 0, 0, 0)
        self.h_layout.setSpacing(0)
        self.v_layout.addLayout(self.h_layout, 1, 0)
        self.v_layout.setRowStretch(1, 1)

        self.b_panel = self.panel()
        self.bottom = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.BottomToTop,
                                           self.b_panel)
        self.v_layout.addWidget(self.b_panel, 2, 0)
        self.v_layout.setRowStretch(2, 0)

        self.l_panel = self.panel()
        self.left_top = QtWidgets.QStackedLayout(self.l_panel)
        self.h_layout.addWidget(self.l_panel, 0, 0)
        self.h_layout.setColumnStretch(0, 0)

        self.t_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        self.h_layout.addLayout(self.t_layout, 0, 1)
        self.h_layout.setColumnStretch(1, 1)

        self.t_panel = self.panel()
        self.top = VLayout(self.t_panel)
        self.top.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.t_layout.addWidget(self.t_panel)
        self.t_panel.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
                                   QtWidgets.QSizePolicy.Maximum)

        self.canvas = Canvas(self, app=self.app)
        self.t_layout.addWidget(self.canvas)

        self.r_panel = self.panel()
        self.right_top = QtWidgets.QStackedLayout(self.r_panel)
        self.h_layout.addWidget(self.r_panel, 0, 2)
        self.h_layout.setColumnStretch(2, 0)

        self.progressBar = qtgui.ProgressBar()
        self.bottom.addWidget(self.progressBar)
Exemple #5
0
    def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        #self.resize(800,600)

        self.frame1 = QCILViewerWidget(
            viewer=viewer2D,
            shape=(600, 600),
            interactorStyle=vlink.Linked2DInteractorStyle)
        self.frame2 = QCILViewerWidget(
            viewer=viewer2D,
            shape=(600, 600),
            interactorStyle=vlink.Linked2DInteractorStyle)

        # Initially link viewers
        self.linkedViewersSetup()
        self.linker.enable()

        layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        layout.addWidget(self.frame1)
        layout.addWidget(self.frame2)

        cw = QtWidgets.QWidget()
        cw.setLayout(layout)
        self.setCentralWidget(cw)
        self.central_widget = cw

        self.show()
Exemple #6
0
    def __init__(self):
        super(Window, self).__init__()
        box = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self)
        self.resize(500, 200)
        self.setLayout(box)

        self.canvas_0 = SceneCanvas(bgcolor='w')
        self.vb_0 = ViewBox(parent=self.canvas_0.scene, bgcolor='r')
        self.vb_0.camera.rect = -1, -1, 2, 2
        self.canvas_0.events.initialize.connect(self.on_init)
        self.canvas_0.events.resize.connect(
            partial(on_resize, self.canvas_0, self.vb_0))
        box.addWidget(self.canvas_0.native)

        # pass the context from the first canvas to the second
        self.canvas_1 = SceneCanvas(bgcolor='w', shared=self.canvas_0.context)
        self.vb_1 = ViewBox(parent=self.canvas_1.scene, bgcolor='b')
        self.vb_1.camera.rect = -1, -1, 2, 2
        self.canvas_1.events.resize.connect(
            partial(on_resize, self.canvas_1, self.vb_1))
        box.addWidget(self.canvas_1.native)

        self.tick_count = 0
        self.timer = Timer(interval=1., connect=self.on_timer, start=True)
        self.setWindowTitle('Shared contexts')
        self.show()
Exemple #7
0
    def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        #self.resize(800,600)

        self.frame1 = QCILViewerWidget(
            viewer=viewer2D,
            shape=(600, 600),
            interactorStyle=vlink.Linked2DInteractorStyle)
        self.frame2 = QCILViewerWidget(
            viewer=viewer3D,
            shape=(600, 600),
            interactorStyle=vlink.Linked3DInteractorStyle)

        reader = vtk.vtkMetaImageReader()
        reader.SetFileName('head.mha')
        reader.Update()

        self.frame1.viewer.setInputData(reader.GetOutput())
        self.frame2.viewer.setInputData(reader.GetOutput())

        # Initially link viewers
        self.linkedViewersSetup()
        self.link2D3D.enable()

        layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        layout.addWidget(self.frame1)
        layout.addWidget(self.frame2)

        cw = QtWidgets.QWidget()
        cw.setLayout(layout)
        self.setCentralWidget(cw)
        self.central_widget = cw
        self.show()
Exemple #8
0
    def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)

        self.textbox = Qtw.QTextEdit()
        self.layout = Qtw.QBoxLayout(Qtw.QBoxLayout.LeftToRight, self)
        self.setLayout(self.layout)
        self.init_widget()
Exemple #9
0
    def __init__(self,
                 ballnumbers,
                 highestnumber,
                 bonusnumbers=False,
                 highestbonus=False):
        """Init the class DlgShowDrawing
        """
        super(DlgShowDrawing, self).__init__()

        self.setWindowIcon(
            QtGui.QIcon(
                os.path.abspath(
                    os.path.join(os.path.dirname(__file__), "..", "..", "misc",
                                 "pyLottoSimu.svg"))))
        self.setModal(True)
        self.buttonBox = QtWidgets.QDialogButtonBox(self)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)

        self.boxLayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom,
                                              self)

        self.gridLayout = QtWidgets.QGridLayout()
        self.gridbonus = QtWidgets.QGridLayout()
        self.ballnumbers = ballnumbers
        self.highestnumber = highestnumber
        self.bonusnumbers = bonusnumbers
        self.highestbonus = highestbonus

        self.initbuttons()
Exemple #10
0
	def __init__(self, position, text, color, context, signals, Parent=None):

		super(Color, self).__init__(Parent)

		self.parent = Parent
		self.context = context
		self.signals = signals

		self.position = position
		self.color = QtGui.QColor(color[0], color[1], color[2])

		self.setObjectName("Color")
		self.setFixedSize(128, 32)
		self.setStyleSheet("background-color: " + self.color.name() + ";")

		self.setAcceptDrops(True)

		layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
		layout.setContentsMargins(2, 2, 2, 2)
		text_label = QtWidgets.QLabel(text)
		text_label.setAlignment(Qt.AlignCenter)
		if color[0]+color[1]+color[2]>255:
			text_label.setStyleSheet("color: black")
		layout.addWidget(text_label)
		self.setLayout(layout)
Exemple #11
0
    def init_charts(self):
        set0 = QBarSet("Jane")
        set1 = QBarSet("John")
        set0.append(1)
        set0.append(2)
        set0.append(3)
        set1.append(5)
        set1.append(1)
        set1.append(4)

        series = QBarSeries()
        series.append(set0)
        series.append(set1)

        chart = QChart()
        chart.addSeries(series)
        chart.setTitle("SampleBar")
        chart.setAnimationOptions(QChart.SeriesAnimations)

        axis = QBarCategoryAxis()
        axis.append(["1", "2", "3"])

        chart.createDefaultAxes()
        chart.setAxisX(axis, series)

        view = QChartView(chart)
        view.setRenderHint(QPainter.Antialiasing)

        layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom,
                                      parent=self)
        self.setLayout(layout)
        layout.addWidget(view)

        self.resize(420, 300)
        self.show()
Exemple #12
0
 def __init__(self):
     super(TaskPanel, self).__init__()
     self.setMinimumHeight(250)
     self.child = QtWidgets.QWidget()
     self.child.setContentsMargins(0, 0, 0, 0)
     self.child.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
     self.setWidget(self.child)
     self.layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom, self.child)
Exemple #13
0
    def init_widget(self):  # 위젯 초기 설정
        self.setWindowTitle("Custom Signal")
        form_lbx = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom, parent=self)  # 레이아웃 상하 정렬
        self.setLayout(form_lbx)

        self.tic_gen.Tic.connect(lambda: self.text.insertPlainText(time.strftime("[%H:%M:%S] Tic!\n")))  # Print Plain Text

        form_lbx.addWidget(self.text)
Exemple #14
0
    def __init__(self, display):
        QtWidgets.QWidget.__init__(self, None)
        self.setWindowTitle('PyQt Test GUI')

        self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self)
        self.boxlayout.addWidget(display, 1)

        self.resize(800, 500)
    def layout_init(self):
        self.name_f = QtWidgets.QLabel('Enter value:')
        self.textbox = QtWidgets.QLineEdit()

        self.tablewidget = QtWidgets.QTableView()
        self.tablewidget.setSortingEnabled(True)

        self.pb = QtWidgets.QPushButton(self.tr('Run process'))
        self.pb.setDisabled(True)
        self.textbox.textChanged.connect(self.disable_button)
        self.pb.clicked.connect(self.on_clicked_pb)
        self.clearbutton = QtWidgets.QPushButton(self.tr('Clear all'))
        self.clearbutton.setDisabled(True)
        self.clearbutton.clicked.connect(self.on_clicked_clear)

        self.toggle = True
        self.b1 = QtWidgets.QCheckBox('Yes, I know the value', self)
        self.b1.setChecked(self.toggle)
        self.b2 = QtWidgets.QCheckBox('I am not sure about this value...',
                                      self)
        self.b2.setChecked(not self.toggle)
        self.b1.clicked.connect(self.toggle_checkbox)
        self.b2.clicked.connect(self.toggle_checkbox)

        searchpanel_f = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        searchpanel_f.addWidget(self.name_f)
        searchpanel_f.addWidget(self.textbox)
        checkbox = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        checkbox.addWidget(self.b1)
        checkbox.addWidget(self.b2)

        wgroupbox = QtWidgets.QGroupBox('Options')
        mainpanel = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        mainpanel.addLayout(searchpanel_f)
        self.topbot = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        self.topbot.addLayout(mainpanel)
        self.topbot.addLayout(checkbox)
        self.topbot.addWidget(self.clearbutton)
        self.topbot.addWidget(self.pb)
        wgroupbox.setLayout(self.topbot)

        grid = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom, self)
        grid.addWidget(wgroupbox)
        grid.addWidget(self.tablewidget)
        self.setLayout(grid)
Exemple #16
0
    def init_ui(self):
        self.fig1 = Figure1()
        self.toolbar = NavigationToolbar(self.fig1.canvas, self)
        self.btn_report = QtWidgets.QPushButton(self.tr('Report'))

        layout = QtWidgets.QBoxLayout()
        layout.addWidget(self.toolbar)
        layout.addWidget(self.fig1.canva)
        layout.addWidget(self.btn_report)
Exemple #17
0
 def __init__(self, direction, parent=None):
     """Create a new WidgetList laying out children in the specified direction (confer the
     QBoxLayout::Direction-enum) and using the given parent."""
     QtWidgets.QWidget.__init__(self, parent)
     self.setLayout(QtWidgets.QBoxLayout(direction))
     self.children = []
     self.selectionManager = None
     self.layout().setSpacing(0)
     self.layout().setContentsMargins(0, 0, 0, 0)
Exemple #18
0
 def __init__(self, name, cls, args=(), style="", direction=0, parent=None):
     QW.QWidget.__init__(self, parent)
     self.parent = parent
     self.set_name_and_style(name, style)
     self.layout = QW.QBoxLayout(direction, self)
     if not self.boxed:
         self.layout.addWidget(QW.QLabel(self.name))
     self.field = cls(*args)
     self.layout.addWidget(self.field)
     self.setContentsMargins(5, 5, 5, 5)
 def __init__(self, widget):
     super().__init__()
     self.aspect_ratio = 1
     self.setLayout(QtWidgets.QBoxLayout(
         QtWidgets.QBoxLayout.LeftToRight, self))
     #  add spacer, then widget, then spacer
     self.layout().addItem(QtWidgets.QSpacerItem(0, 0))
     self.layout().addWidget(widget)
     self.layout().addItem(QtWidgets.QSpacerItem(0, 0))
     self.w = 0
     self.h = 0
    def __init__(self, app, parent_win, title, name=None):
        super().__init__(parent_win)

        self.name = name  # used for debug

        self.text_file_name = QtWidgets.QLineEdit()
        self.text_file_name.setText(title)
        self.text_file_name.setReadOnly(True)

        self.ed = DiffBodyText(app, self, name=self.name)

        v_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        v_layout.addWidget(self.ed.diff_line_numbers)
        v_layout.addWidget(self.ed)

        h_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        h_layout.addWidget(self.text_file_name)
        h_layout.addLayout(v_layout)

        self.setLayout(h_layout)
Exemple #21
0
    def init_widget(self):
        self.setWindowTitle("Python Clicker")
        form_lbx = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom,
                                        parent=self)
        self.setLayout(form_lbx)

        # Signal Slot connect
        self.btn.clicked.connect(self.count)

        form_lbx.addWidget(self.lb)
        form_lbx.addWidget(self.btn)
    def __init__(self, parent=None, originatingWidget=None):
        QtWidgets.QFrame.__init__(self, parent)
        self.is_screenshot_widget = False
        self.qvtkWidget = QVTKRenderWindowInteractor(self)  # a QWidget

        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        # MDIFIX
        self.parentWidget = ref(originatingWidget)

        self.plane = None
        self.planePos = None

        self.lineEdit = QtWidgets.QLineEdit()

        self.init_cross_section_actions()
        self.cstb = self.initCrossSectionToolbar()

        layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
        layout.addWidget(self.cstb)
        layout.addWidget(self.qvtkWidget)
        self.setLayout(layout)
        self.setMinimumSize(100, 100)  # needs to be defined to resize smaller than 400x400
        self.resize(600, 600)

        self.qvtkWidget.Initialize()
        self.qvtkWidget.Start()

        # todo 5 - adding generic drawer

        self.gd = GenericDrawer()
        self.gd.set_interactive_camera_flag(True)
        self.gd.set_pixelized_cartesian_scene(Configuration.getSetting("PixelizedCartesianFields"))

        # placeholder for current screenshot data
        self.current_screenshot_data = None

        # placeholder for currently used basic simulation data
        self.current_bsd = None

        self.camera2D = self.gd.get_active_camera()
        self.camera3D = self.gd.get_renderer().MakeCamera()

        self.renWin = self.qvtkWidget.GetRenderWindow()
        self.renWin.AddRenderer(self.gd.get_renderer())

        self.metadata_fetcher_dict = {
            'CellField': self.get_cell_field_metadata,
            'ConField': self.get_con_field_metadata,
            'ScalarField': self.get_con_field_metadata,
            'ScalarFieldCellLevel': self.get_con_field_metadata,
            'VectorField': self.get_vector_field_metadata,
            'VectorFieldCellLevel': self.get_vector_field_metadata,
        }
    def init_widget(self):  # 위젯 초기화
        self.setWindowTitle("Custom Signal return type")
        form_lbx = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom, parent=self)  # 상하 정렬
        self.setLayout(form_lbx)

        # Connect Signal and Slot
        self.otp_gen.ValueChanged.connect(self.lb_token.setText)
        self.otp_gen.ExpiresIn.connect(lambda v: self.lb_expire_time.setText(str(v)))

        form_lbx.addWidget(self.lb_token)
        form_lbx.addWidget(self.lb_expire_time)
    def init_widget(self):
        self.setWindowTitle("Signal Slot")
        form_lbx = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom,
                                        parent=self)
        self.setLayout(form_lbx)

        self.dl.valueChanged.connect(self.sd.setValue)
        self.sd.valueChanged.connect(self.dl.setValue)

        form_lbx.addWidget(self.dl)
        form_lbx.addWidget(self.sd)
Exemple #25
0
 def __init__(self, state=None, **args):
     super().__init__(**args)
     self.backend = None
     self.areaChanged.connect(self._areaChanged)
     
     self.topLayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
     self._areaChanged(self.area) # the direction of topLayout depends on the area 
     self.topLayout.setContentsMargins(0,0,0,0)
     profile = playlistdelegate.PlaylistDelegate.profileType.default()
     self.stackWidget = QtWidgets.QStackedWidget()
     self.titleWidget = delegatewidget.DelegateWidget(playlistdelegate.PlaylistDelegate(None, profile))
     self.stackWidget.addWidget(self.titleWidget)
     self.statusLabel = QtWidgets.QLabel()
     self.statusLabel.linkActivated.connect(lambda: self.backend.connectBackend())
     self.stackWidget.addWidget(self.statusLabel)
     self.topLayout.addWidget(self.stackWidget, 1)
     
     buttonLayout = QtWidgets.QHBoxLayout()
     buttonLayout.setContentsMargins(0,0,0,0)
     # Do not inherit spacing from self.topLayout, see self._areaChanged
     buttonLayout.setSpacing(self.style().pixelMetric(QtWidgets.QStyle.PM_LayoutHorizontalSpacing))
     self.topLayout.addLayout(buttonLayout)
     
     self.skipBackwardButton = QtWidgets.QToolButton()
     self.skipBackwardButton.setIcon(QtGui.QIcon(utils.images.renderSvg(renderer, "media_skip_backward",
                                                                        ICON_SIZE, 10)))
     self.ppButton = PlayPauseButton(self)
     self.stopButton = QtWidgets.QToolButton()
     self.stopButton.setIcon(QtGui.QIcon(utils.images.renderSvg(renderer, "media_playback_stop",
                                                                ICON_SIZE, ICON_SIZE)))
     self.skipForwardButton = QtWidgets.QToolButton()
     self.skipForwardButton.setIcon(QtGui.QIcon(utils.images.renderSvg(renderer, "media_skip_forward",
                                                                       ICON_SIZE, 10)))
     self.volumeButton = VolumeButton()
     
     for button in (self.skipBackwardButton, self.ppButton, self.stopButton,
                    self.skipForwardButton, self.volumeButton):
         button.setAutoRaise(True)
         buttonLayout.addWidget(button)
     buttonLayout.addStretch()
         
     bottomLayout = QtWidgets.QHBoxLayout()
     self.seekLabel = QtWidgets.QLabel("", self)
     self.seekSlider = SeekSlider(self)
     bottomLayout.addWidget(self.seekSlider)
     bottomLayout.addWidget(self.seekLabel)
     mainLayout = QtWidgets.QVBoxLayout(self)
     mainLayout.addLayout(self.topLayout)
     mainLayout.addLayout(bottomLayout)
     self.seekSlider.sliderMoved.connect(self.updateSeekLabel)
     
     levels.real.connect(self.handleLevelChange)
Exemple #26
0
	def getServerWidget(self):
		if self.serverWidget is not None:
			return self.serverWidget

		print("Iniciando Xephyr!")
		system("\"C:\\Program Files (x86)\\Xming\\Xming.exe\" :0 -clipboard -multiwindow")
		sleep(1)
		self.process.start("ubuntu1804 -c DISPLAY=:0 Xephyr -ac -br -resizeable -no-host-grab -reset -terminate -screen 640x480 " + self.display + " -title " + self.title)
		tries = 0
		stdout = b''
	
		# Espera inicialização do Xephyr e
		# extrai o winId da janela do display virtual
		winId = -1
		while winId == -1:
			sleep(1)
			if tries == 10:
				raise Exception("Servidor Xephyr não encontrado!")
			tries += 1
			
			def callbackDEF(h, hh):
				if win32gui.IsWindowVisible (h) and win32gui.IsWindowEnabled (h):
					hh.append(h)
				return True

			hwnds = []
			win32gui.EnumWindows(callbackDEF, hwnds)


			for win in hwnds:
				if win32gui.GetWindowText(win) == self.title:
					winId = int(win)
					break
                        
		self.new_window = QtGui.QWindow.fromWinId(winId)
		
		print("winId = " + str(winId))
	
		# FramelessWindow permite "colar" a janela do servidor na janela do editor
		self.new_window.setFlags(Qt.FramelessWindowHint)
	
		self.game_widget = QtWidgets.QWidget.createWindowContainer(self.new_window)
	
		# O widget que recebe o vídeo deve ser algum widget que tenha
		# informações visuais, como o textEdit ou o graphicsView
		self.serverWidget = QtWidgets.QWidget()
	
		# De fato "cola" a janela do servidor dentro de um widget
		self.game_box = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self.serverWidget)
		self.game_box.addWidget(self.game_widget)

		return self.serverWidget
 def create_layout_label():
     label0 = QtWidgets.QLabel()
     label1 = QtWidgets.QLabel()
     label2 = QtWidgets.QLabel()
     label3 = QtWidgets.QLabel()
     label0.setText('Orange:')
     label1.setText('Play:')
     label2.setText('PLK:')
     label3.setText('TMobile:')
     panel = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
     panel.addWidget(label0), panel.addWidget(label1),
     panel.addWidget(label2), panel.addWidget(label3)
     return panel
Exemple #28
0
    def __init__(self, name="", data={}, style="", direction=0, parent=None):
        InputField.__init__(self, name, QW.QWidget, (parent, ), style,
                            direction, parent)
        layout = QW.QBoxLayout((direction + 2) % 4, self.field)
        self.fields = {}

        for k, v in data.items():
            self.fields[k] = getField(v,
                                      k,
                                      style=style,
                                      direction=direction,
                                      parent=self)
            layout.addWidget(self.fields[k])
Exemple #29
0
    def init_widget(self):
        self.setWindowTitle("Signal and Slot with Lambda")
        form_lbx = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom,
                                        parent=self)
        self.setLayout(form_lbx)

        # QtWidgets.QLabel.setText() : only get string.
        # 정수형을 주는 QtWidgets.QSlider.valueChange() 를 바로 사용할 수 없다.
        # 해결 방법 : lambda를 이용하여 값을 넘겨주는 방식.

        self.sd.valueChanged.connect(lambda v: self.lb.setText(str(v)))

        form_lbx.addWidget(self.lb)
        form_lbx.addWidget(self.sd)
Exemple #30
0
    def __init__(self):  
        super(SceneViewPanel, self).__init__()

        self._show_points = False
        self.display_options = DisplayOptionsWidget(self)

        self.views_layout = None

        self.views_layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        self.views_layout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
        self.addWidget(self.display_options)
        self.addLayout(self.views_layout)
        

        # layout switching button
        self.layouts_button = QtWidgets.QPushButton(self)
        self.layouts_button.setToolTip('Switch layout')

        mapper = QtCore.QSignalMapper(self)
        layouts_menu = QtWidgets.QMenu()

        for layout_name in viewport_layouts:
            layout = viewport_layouts[layout_name]
            action = QtWidgets.QAction(QtGui.QIcon(layout['icon']), layout['title'], self)
            mapper.setMapping(action, layout_name)

            shortcut = layout.get('shortcut')
            if shortcut:
                action.setShortcut(shortcut)
            
            action.triggered.connect(mapper.map)
            layouts_menu.addAction(action)

        mapper.mapped['QString'].connect(self.makeViewsLayout)
        self.layouts_button.setMenu(layouts_menu)
        self.path_bar_widget.layout.addWidget(self.layouts_button)

        # create default viewports
        self._viewports = {
            "persp" : GeometryViewport(None, panel=self, view_type=GeometryViewport.viewType.PERSP),
            "top"   : GeometryViewport(None, panel=self, view_type=GeometryViewport.viewType.TOP),
            "bottom": GeometryViewport(None, panel=self, view_type=GeometryViewport.viewType.BOTTOM),
            "left"  : GeometryViewport(None, panel=self, view_type=GeometryViewport.viewType.LEFT),
            "right" : GeometryViewport(None, panel=self, view_type=GeometryViewport.viewType.RIGHT),
        }

        # create default views layout
        self.makeViewsLayout(layout_name="single_view")