Exemplo n.º 1
1
    def __init__(self, url, color):
        QWidget.__init__(self)
        self.setStyleSheet("background-color: black")

        self.file_name_font = QFont()
        self.file_name_font.setPointSize(24)

        self.file_name_label = QLabel(self)
        self.file_name_label.setText(url)
        self.file_name_label.setFont(self.file_name_font)
        self.file_name_label.setAlignment(Qt.AlignCenter)
        self.file_name_label.setStyleSheet("color: #eee")

        self.qrcode_label = QLabel(self)

        self.notify_font = QFont()
        self.notify_font.setPointSize(12)
        self.notify_label = QLabel(self)
        self.notify_label.setText("Scan above QR to copy information")
        self.notify_label.setFont(self.notify_font)
        self.notify_label.setAlignment(Qt.AlignCenter)
        self.notify_label.setStyleSheet("color: #eee")

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter)
        layout.addSpacing(20)
        layout.addWidget(self.file_name_label, 0, Qt.AlignCenter)
        layout.addSpacing(40)
        layout.addWidget(self.notify_label, 0, Qt.AlignCenter)
        layout.addStretch()

        self.qrcode_label.setPixmap(qrcode.make(url, image_factory=Image).pixmap())
Exemplo n.º 2
0
    def __init__(self, font, *args):
        QWidget.__init__(self, *args)
        self._browser = QTextEdit(self)
        self._browser.setReadOnly(True)
        document = self._browser.document()
        document.setDefaultStyleSheet(document.defaultStyleSheet() +
                                      "span {white-space:pre;}")

        self._browser.setFont(font)
        self._edit = _TextEdit(self, font)

        lowLevelWidget = self._edit.focusProxy()
        if lowLevelWidget is None:
            lowLevelWidget = self._edit
        lowLevelWidget.installEventFilter(self)

        self._edit.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
        self.setFocusProxy(self._edit)

        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._browser)
        layout.addWidget(self._edit)

        self._history = ['']  # current empty line
        self._historyIndex = 0

        self._edit.setFocus()
Exemplo n.º 3
0
	def __init__(self):
		QWidget.__init__(self)
		self.win_list=windows()
		self.setFixedSize(900, 600)
		self.setWindowIcon(QIcon(os.path.join(get_image_file_path(),"doping.png")))
		self.setWindowTitle(_("Doping profile editor (www.gpvdm.com)")) 

		self.win_list.set_window(self,"doping")
		self.main_vbox=QVBoxLayout()

		toolbar=QToolBar()
		toolbar.setIconSize(QSize(48, 48))

		self.save = QAction(QIcon(os.path.join(get_image_file_path(),"save.png")), _("Save"), self)
		self.save.triggered.connect(self.callback_save)
		toolbar.addAction(self.save)

		spacer = QWidget()
		spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
		toolbar.addWidget(spacer)


		self.help = QAction(QIcon(os.path.join(get_image_file_path(),"help.png")), _("Help"), self)
		self.help.triggered.connect(self.callback_help)
		toolbar.addAction(self.help)

		self.main_vbox.addWidget(toolbar)

		self.fig = Figure(figsize=(5,4), dpi=100)
		self.ax1=None
		self.show_key=True
		canvas = FigureCanvas(self.fig)
		#canvas.set_background('white')
		#canvas.set_facecolor('white')
		canvas.figure.patch.set_facecolor('white')
		canvas.show()

		self.main_vbox.addWidget(canvas)

		self.tab = QTableWidget()
		self.tab.resizeColumnsToContents()

		self.tab.verticalHeader().setVisible(False)

		self.tab.clear()
		self.tab.setColumnCount(4)
		self.tab.setSelectionBehavior(QAbstractItemView.SelectRows)

		self.load()
		self.build_mesh()

		self.tab.cellChanged.connect(self.tab_changed)

		self.main_vbox.addWidget(self.tab)


		self.draw_graph()

		self.setLayout(self.main_vbox)
		return
Exemplo n.º 4
0
    def __init__(self, parentWidget, markerFmt, editWidget):
        QWidget.__init__(self, parentWidget)

        self.markerFormat = markerFmt
        self.textEdit = editWidget
        self.startPos = 0
        self.endPos = 0
        self.pattern = ''

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.searchPattern = CancelAwareLineEdit(self)
        self.searchPattern.setPlaceholderText('Start typing to find in page')
        self.searchPattern.editingFinished.connect(self.hideWidget)
        self.searchPattern.textEdited.connect(self.doSearch)

        upAction = QAction(QIcon(':/icons/find-up.png'), "Find backwards (Shift-F3)", self)
        upAction.setShortcut(Qt.SHIFT + Qt.Key_F3);
        upAction.triggered.connect(self.findUpwards)
        self.upButton = QToolButton(self)
        self.upButton.setDefaultAction(upAction)

        downAction = QAction(QIcon(':/icons/find-down.png'), "Find next (F3)", self)
        downAction.setShortcut(Qt.Key_F3);
        downAction.triggered.connect(self.findDownwards)
        self.downButton = QToolButton(self)
        self.downButton.setDefaultAction(downAction)

        layout.addWidget(self.searchPattern)
        layout.addWidget(self.upButton)
        layout.addWidget(self.downButton)
Exemplo n.º 5
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.parent = parent
        self.objets = parent.objets
        self.panel = self.parent.parent.panel
        self.canvas = self.parent.parent.canvas
        self.islabel = self.parent.parent.islabel

        self.sizer = QVBoxLayout()
        if len(self.objets) is 1:
            self.objet = self.objets[0]

            style = QVBoxLayout()
            style_box = QGroupBox("Style de l'objet")
            style_box.setLayout(style)
            style.addWidget(QLabel("<span style='color:red;font-style:italic;'>Attention, ne modifiez ce contenu que si vous savez ce que vous faites.</span>"))
            self.avance = QTextEdit()
            self.avance.setMinimumSize(350, 200)
            self.actualiser()
            style.addWidget(self.avance)
            self.sizer.addWidget(style_box)

            ok = QPushButton('OK')
            appliquer = QPushButton("Appliquer")
            actualiser = QPushButton("Actualiser")
            ok.clicked.connect(self.EvtOk)
            appliquer.clicked.connect(self.EvtAppliquer)
            actualiser.clicked.connect(self.actualiser)
            boutons = QHBoxLayout()
            boutons.addWidget(ok)
            boutons.addWidget(appliquer)
            boutons.addWidget(actualiser)
            self.sizer.addLayout(boutons)

        self.setLayout(self.sizer)
Exemplo n.º 6
0
    def __init__(self, parent, centerOnParent=True,
                 disableParentWhenSpinning=False, modality=Qt.NonModal):
        # super().__init__(parent)
        QWidget.__init__(self, parent)

        self._centerOnParent = centerOnParent
        self._disableParentWhenSpinning = disableParentWhenSpinning

        # WAS IN initialize()
        self._color = QColor(Qt.black)
        self._roundness = 100.0
        self._minimumTrailOpacity = 3.14159265358979323846
        self._trailFadePercentage = 80.0
        self._revolutionsPerSecond = 1.57079632679489661923
        self._numberOfLines = 20
        self._lineLength = 10
        self._lineWidth = 2
        self._innerRadius = 10
        self._currentCounter = 0
        self._isSpinning = False

        self._timer = QTimer(self)
        self._timer.timeout.connect(self.rotate)
        self.updateSize()
        self.updateTimer()
        self.hide()
        # END initialize()

        self.setWindowModality(modality)
        self.setAttribute(Qt.WA_TranslucentBackground)
Exemplo n.º 7
0
    def __init__(self, win):
        QWidget.__init__(self)
        self.win = win
        self.setWindowTitle('Electrum - '+_('Payment Request'))
        self.setMinimumSize(800, 250)
        self.address = ''
        self.label = ''
        self.amount = 0
        self.setFocusPolicy(QtCore.Qt.NoFocus)

        main_box = QHBoxLayout()

        self.qrw = QRCodeWidget()
        main_box.addWidget(self.qrw, 1)

        vbox = QVBoxLayout()
        main_box.addLayout(vbox)

        self.address_label = QLabel("")
        #self.address_label.setFont(QFont(MONOSPACE_FONT))
        vbox.addWidget(self.address_label)

        self.label_label = QLabel("")
        vbox.addWidget(self.label_label)

        self.amount_label = QLabel("")
        vbox.addWidget(self.amount_label)

        vbox.addStretch(1)
        self.setLayout(main_box)
Exemplo n.º 8
0
    def __init__(self, pubsub_gateway, player_kwargs=None):
        CliApp.__init__(self, pubsub_gateway, player_kwargs=player_kwargs)
        QWidget.__init__(self)

        self.request = Request(self)
        self.tips_manager = TipsManager(self)
        self.hotkey_manager = Hotkey(self)
        #: collections manager
        self.coll_mgr = CollectionManager(self)

        self.img_ctl = ImgController(self)

        self.playlists = PlaylistsModel(parent=self)
        self.histories = HistoriesModel(parent=self)
        self.providers = ProvidersModel(parent=self)
        self.my_music = MyMusicModel(parent=self)
        self.collections = CollectionsModel(parent=self)

        self.ui = Ui(self)

        self.player_pixmap = None
        self.show_msg = self.ui.magicbox.show_msg

        self.resize(1000, 618)
        self.setObjectName('app')
        QApplication.setWindowIcon(QIcon(APP_ICON))

        self.bind_signal()
Exemplo n.º 9
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     self.setMinimumHeight(gui_scale() * 80)
     self.setMaximumHeight(gui_scale() * 80)
     self.setMinimumWidth(1)
     self.setMaximumWidth(1)
     self.setLayout(QHBoxLayout())
Exemplo n.º 10
0
 def __init__(self, parent, name):
     QWidget.__init__(self, parent)
     self.setStyleSheet(get_stylesheet("ribbonPane"))
     horizontal_layout = QHBoxLayout()
     horizontal_layout.setSpacing(0)
     horizontal_layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(horizontal_layout)
     vertical_widget = QWidget(self)
     horizontal_layout.addWidget(vertical_widget)
     horizontal_layout.addWidget(RibbonSeparator(self))
     vertical_layout = QVBoxLayout()
     vertical_layout.setSpacing(0)
     vertical_layout.setContentsMargins(0, 0, 0, 0)
     vertical_widget.setLayout(vertical_layout)
     label = QLabel(name)
     label.setAlignment(Qt.AlignCenter)
     label.setStyleSheet("color:#666;")
     content_widget = QWidget(self)
     vertical_layout.addWidget(content_widget)
     vertical_layout.addWidget(label)
     content_layout = QHBoxLayout()
     content_layout.setAlignment(Qt.AlignLeft)
     content_layout.setSpacing(0)
     content_layout.setContentsMargins(0, 0, 0, 0)
     self.contentLayout = content_layout
     content_widget.setLayout(content_layout)
Exemplo n.º 11
0
    def __init__(self, parentWidget):
        QWidget.__init__(self, parentWidget)
        
        self.editorWidget = parentWidget.editorWidget   # TODO: Review class structure

        self.searching = False
        self.ui = Ui_SearchWidget()
        self.ui.setupUi(self)
        self.resultListModel = QStandardItemModel(self.ui.resultList)
        self.ui.resultWidget.setCurrentIndex(0)
        self.ui.resultList.setModel(self.resultListModel)
        self.ui.resultList.selectionModel().selectionChanged.connect(self.doResultSelected)

        self.startIcon = QIcon(':/icons/search-global-start.png')
        self.stopIcon = QIcon(':/icons/search-global-stop.png')
        self.ui.startStopButton.setIcon(self.startIcon)

        self.ui.searchInput.returnPressed.connect(self.doReturnKey)
        self.ui.startStopButton.clicked.connect(self.doStartStopButton)

        self.workerThread = QThread()
        self.worker = SearchWorker()
        self.worker.moveToThread(self.workerThread)
        self.startWork.connect(self.worker.startSearch)
        self.worker.searchDone.connect(self.searchDone)
        self.worker.addMatch.connect(self.addMatch)
        # self.stopWork.connect(self.worker.stopSearch)
        self.workerThread.start()
Exemplo n.º 12
0
    def __init__(self, parent = None, plugin = None):
        QWidget.__init__(self, parent)

        self.plugin = plugin

        self.ui = Ui_Form()
        self.ui.setupUi(self)


        self.ui.input.sigExecuteCmd.connect(self.runCmd)

        self.ui.output.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.ui.output.customContextMenuRequested.connect(self.showContextMenu)

        self.ui.output.setStyleSheet("background-color: black")
        self.ui.input.setStyleSheet("background-color: black; color: green;")
        self.ui.input.setContentsMargins(0,0,0,0)
        self.ui.output.setContentsMargins(0,0,0,0)

        font = QtGui.QFont("Monospace");
        font.setStyleHint(QtGui.QFont.TypeWriter);

        self.ui.output.setFont(font)

        self.ui.input.setFont(font)

        scrollbar = self.ui.output.verticalScrollBar()
        scrollbar.setStyleSheet("background-color: green")

        self.setStyleSheet("background-color: black")


        self.write("<div style='background-color: #000'>",html=True)
Exemplo n.º 13
0
    def __init__(self):
        QWidget.__init__(self)

        self.setupUi(self)

        self.session        = None # Set from REDTabSettings
        self.script_manager = None # Set from REDTabSettings
        self.image_version  = None # Set from REDTabSettings
        self.service_state  = None # Set from REDTabSettings

        self.is_tab_on_focus = False

        self.saving = False
        self.pbutton_ap_show_dhcp_leases.hide()
        self.label_ap_unsupported.hide()
        self.label_ap_disabled.hide()
        self.label_working_wait.hide()
        self.pbar_working_wait.hide()
        self.sarea_ap.hide()

        self.cbox_ap_interface.currentIndexChanged.connect(self.slot_cbox_ap_interface_current_index_changed)
        self.chkbox_ap_wpa_key_show.stateChanged.connect(self.slot_chkbox_ap_wpa_key_show_state_changed)
        self.chkbox_ap_enable_dns_dhcp.stateChanged.connect(self.update_ui_state)
        self.pbutton_ap_refresh.clicked.connect(self.slot_pbutton_ap_refresh_clicked)
        self.pbutton_ap_save.clicked.connect(self.slot_pbutton_ap_save_clicked)
        self.pbutton_ap_show_dhcp_leases.clicked.connect(self.slot_pbutton_ap_show_dhcp_leases_clicked)
Exemplo n.º 14
0
	def __init__(self,info,title="gpvdm"):
		QWidget.__init__(self)
		self.ret=False
		self.setWindowTitle(title)
		self.setWindowFlags(Qt.WindowStaysOnTopHint)
		self.vbox=QVBoxLayout()
		self.edit_boxes=[]
		for i in range(0,len(info)):
			l=QLabel(info[i][0])
			self.vbox.addWidget(l)

			self.edit_boxes.append(QLineEdit())
			self.edit_boxes[-1].setText(info[i][1])

			self.vbox.addWidget(self.edit_boxes[-1])


		w=QWidget()
		hb=QHBoxLayout()
		w.setLayout(hb)
		ok=QPushButton(_("OK"))
		ok.pressed.connect(self.callback_click_ok)
		cancel=QPushButton(_("Cancel"))
		cancel.pressed.connect(self.callback_click_cancel)
		
		hb.addWidget(cancel)
		hb.addWidget(ok)

		self.vbox.addWidget(w)

		self.setLayout(self.vbox)
Exemplo n.º 15
0
    def __init__(self, db, dbt, parent=None):
        QWidget.__init__(self, parent=parent)
        vq_save.SaveableWidget.__init__(self)
        vtrace.qt.VQTraceNotifier.__init__(self, trace=dbt)

        self.db = db
        self.dbt = dbt
Exemplo n.º 16
0
 def __init__(self):
     QWidget.__init__(self)
     self.request_mgr = None
     self.initialized = False
     self.selected_item = None
     self.dialog = None
     self.wallets = {}
Exemplo n.º 17
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     Form, Base = uic.loadUiType('calc.ui')
     self.form = Form()
     self.form.setupUi(self)
     self.number_one = 0
     self.number_two = 0
     self.operation = ''
     self.text_number_one = ''
     self.text_number_two = ''
     self.form.pushButton.clicked.connect(self.handler)
     self.form.pushButton_2.clicked.connect(self.handler)
     self.form.pushButton_3.clicked.connect(self.handler)
     self.form.pushButton_4.clicked.connect(self.handler)
     self.form.pushButton_5.clicked.connect(self.handler)
     self.form.pushButton_6.clicked.connect(self.handler)
     self.form.pushButton_7.clicked.connect(self.handler)
     self.form.pushButton_8.clicked.connect(self.handler)
     self.form.pushButton_9.clicked.connect(self.handler)
     self.form.pushButton_10.clicked.connect(self.handler)
     self.form.pushButton_11.clicked.connect(self.handler)
     self.form.pushButton_12.clicked.connect(self.handler)
     self.form.pushButton_13.clicked.connect(self.handler)
     self.form.pushButton_14.clicked.connect(self.handler)
     self.form.pushButton_15.clicked.connect(self.handler)
     self.form.pushButton_16.clicked.connect(self.handler)
     self.form.pushButton_17.clicked.connect(self.handler)
     self.form.pushButton_18.clicked.connect(self.handler)
     self.form.lcdNumber.setNumDigits(10)
Exemplo n.º 18
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.parent = parent
        sizer = QVBoxLayout()
        global LOGO
        LOGO = path2(LOGO)
        logo = QLabel(self)
        logo.setPixmap(QPixmap(LOGO))

        sizer.addWidget(logo, 0, Qt.AlignCenter)

        date = "/".join(str(n) for n in reversed(param.date_version))
        textes = ["<b>%s version %s</b>" % (NOMPROG, param.version)]
        textes.append("<i>Version publiée le " + date + "</i>")
        textes.append('')
        textes.append("« Le couteau suisse du prof de maths »")
        textes.append('')
        textes.append("<img src='%s'> <b>%s est un \
                    <a href='http://fr.wikipedia.org/wiki/Logiciel_libre'> \
                    logiciel libre</a></b>"
                    %(path2('%/wxgeometrie/images/copyleft.png'), NOMPROG))
        textes.append("Vous pouvez l'utiliser et le modifier selon les termes de la GNU Public License v2.")
        textes.append("<i>Copyleft 2005-%s Nicolas Pourcelot ([email protected])</i>"
                            % ANNEE)
        textes.append('')
        label = QLabel('<br>'.join(textes))
        label.setAlignment(Qt.AlignCenter)
        label.setOpenExternalLinks(True)

        sizer.addWidget(label, 0, Qt.AlignCenter)
        self.setLayout(sizer)
Exemplo n.º 19
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.setAttribute(Qt.WA_OpaquePaintEvent)

        # defaults are VERTICAL, COLOR_GREEN, STYLE_DEFAULT

        self.fChannelCount = 0
        self.fChannelData = []
        self.fLastChannelData = []

        self.fMeterColor = self.COLOR_GREEN
        self.fMeterColorBase = QColor(93, 231, 61)
        self.fMeterColorBaseAlt = QColor(15, 110, 15, 100)

        self.fMeterLinesEnabled = True
        self.fMeterOrientation = self.VERTICAL
        self.fMeterStyle = self.STYLE_DEFAULT

        self.fMeterBackground = QColor("#070707")
        self.fMeterGradient = QLinearGradient(0, 0, 0, 0)
        self.fMeterPixmaps = ()

        self.fSmoothMultiplier = 2

        self.updateGrandient()
Exemplo n.º 20
0
    def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        layout = QGridLayout(self)
        self.setLayout(layout)

        self.addButton = QPushButton(icons.get('list-add'), '')
        self.editButton = QPushButton(icons.get('document-edit'), '')
        self.removeButton = QPushButton(icons.get('list-remove'), '')
        self.listBox = QListWidget()

        layout.setContentsMargins(1, 1, 1, 1)
        layout.setSpacing(0)
        layout.addWidget(self.listBox, 0, 0, 8, 1)
        layout.addWidget(self.addButton, 0, 1)
        layout.addWidget(self.editButton, 1, 1)
        layout.addWidget(self.removeButton, 2, 1)

        def updateSelection():
            selected = bool(self.listBox.currentItem())
            self.editButton.setEnabled(selected)
            self.removeButton.setEnabled(selected)

        self.changed.connect(updateSelection)
        self.listBox.itemSelectionChanged.connect(updateSelection)
        updateSelection()
        self.connectSlots()
        app.translateUI(self)
Exemplo n.º 21
0
	def __init__(self):
		QWidget.__init__(self)
		self.sun=1
		hbox=QHBoxLayout(self)
		mainLayout = QSplitter(Qt.Horizontal)
       # splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
		self.three_d=display_widget()
		self.three_d.show()

		self.frame=layer_widget()

		self.frame.changed.connect(self.three_d.recalculate)
		
		mainLayout.addWidget(self.frame)
		mainLayout.addWidget(self.three_d)
		hbox.addWidget(mainLayout)
		
		self.setLayout(hbox)

		if enable_webupdates()==True:
			print("Looking for updates")
			self.web_update=update_thread()
			self.web_update.got_data.connect(self.got_help)
			self.web_update.start()
		self.frame.tab.itemSelectionChanged.connect(self.layer_selection_changed)
Exemplo n.º 22
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        self.splitter.setStretchFactor(0, 5)
        self.splitter.setStretchFactor(1, 70)

        self.txtFilter.textChanged.connect(self.textChanged)
        self.txtFilter.textChanged.connect(self.updateListFromData)
        self.txtFilter.returnPressed.connect(self.showInfos)
        self.listDelegate = listCompleterDelegate(self)
        self.list.setItemDelegate(self.listDelegate)
        self.list.itemActivated.connect(self.showInfos)
        self.hideList()
        self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.view.linkActivated.connect(self.openLink)
        self.view.linkHovered.connect(self.linkHovered)
        self.btnShowList.toggled.connect(self.list.setVisible)
        self.line.hide()

        self.outlineModel = None
        self.characterModel = None
        self.plotModel = None
        self.worldModel = None

        self.populateTimer = QTimer(self)
        self.populateTimer.setSingleShot(True)
        self.populateTimer.setInterval(500)
        self.populateTimer.timeout.connect(self.populate)
        self.populateTimer.stop()

        self.data = {}

        self.populate()
Exemplo n.º 23
0
    def __init__(self, app, ui):
        QWidget.__init__(self)
        center_layout = QVBoxLayout()
        self.fwidg = QWidget()
        self.paramfunc = 0
        self.c = Communicate()
        self.c.exec_operation_signal[Myc.FuncCommand].connect(app.exec_command)
        self.application = app
        self.setLayout(center_layout)

        print('ddd')
        self.ui = ui
        self.ui.setupUi(self.fwidg)


        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.fwidg)

        buttonExec = QPushButton()
        buttonExec.setText("Выполнить")
        center_layout.addWidget(buttonExec)
        buttonExec.clicked.connect(self.execOperation)

        splitter.addWidget(buttonExec)
        center_layout.addWidget(splitter)
Exemplo n.º 24
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        uic.loadUi(get_ui_file_path('video_info_popup.ui'), self)

        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
Exemplo n.º 25
0
    def __init__(self, project, settings):
        QWidget.__init__(self)
        self.ui = Ui_ProjectWidget()
        self.ui.setupUi(self)
        self.project = project
        self.project.filesChanged.connect(self.refresh)
        self.toolbar = QToolBar()
        import_image = lambda: ImportImage.pick(lambda f: self.import_image.emit(f[0]), settings)
        self.toolbar.addAction(ImportImage.icon(), ImportImage.ACTION_TEXT, import_image)
        self.ui.import_image.clicked.connect(import_image)
        self.raw_spectra_model = QStandardItemModel()
        self.calibrated_spectra_model = QStandardItemModel()
        self.finished_spectra_model = QStandardItemModel()

        def button_action(button, signal, widget, model):
            button.clicked.connect(lambda: signal.emit(model.item(widget.selectionModel().selectedRows()[0].row()).data() ) )
            widget.selectionModel().selectionChanged.connect(lambda sel, unsel: button.setEnabled(len(sel.indexes())>0))
            
        for model, widget in [(self.raw_spectra_model, self.ui.raw_spectra), (self.calibrated_spectra_model, self.ui.calibrated_spectra), (self.finished_spectra_model, self.ui.finished_spectra)]:
            widget.setModel(model)
            widget.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
            
        button_action(self.ui.calibrate, self.calibrate, self.ui.raw_spectra, self.raw_spectra_model)
        button_action(self.ui.math, self.math, self.ui.calibrated_spectra, self.calibrated_spectra_model)
        button_action(self.ui.finish, self.finish, self.ui.calibrated_spectra, self.calibrated_spectra_model)
        button_action(self.ui.open_finished, self.finish, self.ui.finished_spectra, self.finished_spectra_model)
        open_finished_menu = QMenu()
        self.ui.open_finished_dirs.setMenu(open_finished_menu)
        open_finished_menu.addAction(QIcon(':/image_20'), 'Exported Images folder', lambda: QDesktopServices.openUrl(QUrl.fromLocalFile(project.directory_path(Project.EXPORTED_IMAGES))))
        open_finished_menu.addAction(QIcon(':/done_20'), 'Finished Spectra folder', lambda: QDesktopServices.openUrl(QUrl.fromLocalFile(project.directory_path(Project.FINISHED_PROFILES))))
        

            
        self.refresh()
Exemplo n.º 26
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.options = {
            "All": True,
            "Title": True,
            "Text": True,
            "Summary": False,
            "Notes": False,
            "POV": False,
            "Status": False,
            "Label": False,
            "CS": True
        }

        self.text.returnPressed.connect(self.search)
        self.generateOptionMenu()

        self.delegate = listResultDelegate(self)
        self.result.setItemDelegate(self.delegate)
        self.result.itemClicked.connect(self.openItem)

        self.result.setStyleSheet(style.searchResultSS())
        self.text.setStyleSheet(style.lineEditSS())
Exemplo n.º 27
0
	def __init__(self,index):
		QWidget.__init__(self)

		vbox=QVBoxLayout()


		self.index=index

		toolbar=QToolBar()
		toolbar.setIconSize(QSize(48, 48))


		self.load_type=tb_pulse_load_type(self.index)
		#self.load_type.connect("changed", self.draw_callback)

		toolbar.addWidget(self.load_type)
		vbox.addWidget(toolbar)

		self.diode = QPixmap(os.path.join(get_image_file_path(),"diode.png"))
		self.ideal_diode = QPixmap(os.path.join(get_image_file_path(),"ideal_diode.png"))
		self.load = QPixmap(os.path.join(get_image_file_path(),"load.png"))
		self.ideal_load = QPixmap(os.path.join(get_image_file_path(),"ideal_load.png"))
		self.voc = QPixmap(os.path.join(get_image_file_path(),"voc.png"))

		self.darea = QWidget()

		vbox.addWidget(self.darea)

		self.setLayout(vbox)
		self.load_type.changed.connect(self.repaint)
		return
Exemplo n.º 28
0
        def __init__(self, parent=None, id="~"):
            """
            init
            """
            QWidget.__init__(self, parent)
            self.setupUi(self)

            # center this window
            screen = QDesktopWidget().screenGeometry()
            size = self.geometry()
            self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)

            self.id = id
            self.flagBtn = RichFlagButton(self)
            self.linelayout.addWidget(self.flagBtn)
            self.desc = HtmlWYSIWYG()
            self.desc.setMinimumHeight(200)
            self.desclayout.addWidget(self.desc)

            if not self.id == "~":
                restore = YeahdocDatasSupply().bc_read1(self.id)
                self.flagBtn.setIcon(QIcon(getPath("iconDir", "yeahdoc/flag/%s" % str(restore['img']))))
                self.flagBtn.setText(restore['img'])
                self.title.setText(restore['title'])
                self.desc.fill(restore['desc'])

            QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"), self.__evt_btn_click)
    def __init__(self):
        QWidget.__init__(self)
        self.setupUi(self)

        self.session        = None # Set from REDTabSettings
        self.script_manager = None # Set from REDTabSettings
        self.image_version  = None # Set from REDTabSettings
        self.service_state  = None # Set from REDTabSettings

        self.is_tab_on_focus = False
        self.working = False

        self.image_version_lt_1_10 = True

        self.sarea_mi.hide()

        regex_sim_card_pin = QRegExp('\\d+')
        validator_sim_card_pin = QRegExpValidator(regex_sim_card_pin)
        self.ledit_mi_sim_card_pin.setValidator(validator_sim_card_pin)

        regex_dial = QRegExp('[\\d*#]+')
        validator_dial = QRegExpValidator(regex_dial)
        self.ledit_mi_dial.setValidator(validator_dial)

        self.status_refresh_timer = QTimer(self)

        self.pbutton_mi_provider_presets.clicked.connect(self.pbutton_mi_provider_presets_clicked)
        self.pbutton_mi_refresh.clicked.connect(self.pbutton_mi_refresh_clicked)
        self.pbutton_mi_connect.clicked.connect(self.pbutton_mi_connect_clicked)
        self.chkbox_mi_password.stateChanged.connect(self.chkbox_mi_password_state_changed)
        self.chkbox_mi_sim_card_pin.stateChanged.connect(self.chkbox_mi_sim_card_pin_state_changed)
        self.status_refresh_timer.timeout.connect(self.status_refresh_timer_timeout)
Exemplo n.º 30
0
 def __init__(self, opts, parent=None):
     QWidget.__init__(self, parent=None)
     self.opts = opts
     self.initThread()
     self.initUI()
     self.overlay = LoadingOverlay(self)
     self.overlay.hide()
Exemplo n.º 31
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.path = QPainterPath()
Exemplo n.º 32
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     self.subscribe_button = None
     self.initialized = False
     self.contents_widget = None
     self.channel_rating_label = None
Exemplo n.º 33
0
 def __init__(self, xml=None, parent=None, item=None):
     QWidget.__init__(self, parent=parent)
     self.item = item
     self.build_ui()
Exemplo n.º 34
0
 def __init__(self, parent=None):
     QWidget.__init__(self)
     self.setupUi(self)
     self.txtSummarySentence.setColumn(Outline.summarySentence.value)
     self.txtSummaryFull.setColumn(Outline.summaryFull.value)
     self.txtGoal.setColumn(Outline.setGoal.value)
Exemplo n.º 35
0
 def __init__(self, informationTab, parent=None):
     QWidget.__init__(self, parent)
     self.informationTab = informationTab
     self.setupLayout()
     self.updateFields()  # set default values
Exemplo n.º 36
0
 def __init__(self):
     QWidget.__init__(self)
     #self.setMinimumSize(600, 500)
     self.suns = 1
     global_object_register("gl_force_redraw", self.force_redraw)
Exemplo n.º 37
0
 def __init__(self):
     QWidget.__init__(self)
     self.trust_plot = None
     self.history = None
     self.byte_scale = 1024 * 1024
     self.dialog = None
Exemplo n.º 38
0
    def __init__(self, hole=None, matlib=[]):
        """Initialize the widget according to hole

        Parameters
        ----------
        self : PHoleM52
            A PHoleM52 widget
        hole : HoleM52
            current hole to edit
        matlib : list
            List of available Material
        """
        # Build the interface according to the .ui file
        QWidget.__init__(self)
        self.setupUi(self)

        self.matlib = matlib
        self.hole = hole

        # Set FloatEdit unit
        self.lf_W0.unit = "m"
        self.lf_W3.unit = "m"
        self.lf_H0.unit = "m"
        self.lf_H1.unit = "m"
        self.lf_H2.unit = "m"

        # Set default materials
        self.w_mat_0.setText("magnet_0:")
        self.w_mat_0.def_mat = "Magnet1"

        # Set unit name (m ou mm)
        self.u = gui_option.unit
        wid_list = [
            self.unit_W0,
            self.unit_W3,
            self.unit_H0,
            self.unit_H1,
            self.unit_H2,
        ]
        for wid in wid_list:
            wid.setText(self.u.get_m_name())

        # Adapt GUI with/without magnet
        if hole.magnet_0 is None:  # SyRM
            self.img_slot.setPixmap(
                QPixmap(
                    ":/images/images/MachineSetup/WSlot/Slot_52_no_mag.PNG"))
            self.w_mat_0.hide()
        else:
            self.w_mat_0.update(self.hole.magnet_0, "mat_type", self.matlib)

        # Fill the fields with the machine values (if they're filled)
        self.lf_W0.setValue(self.hole.W0)
        self.lf_W3.setValue(self.hole.W3)
        self.lf_H0.setValue(self.hole.H0)
        self.lf_H1.setValue(self.hole.H1)
        self.lf_H2.setValue(self.hole.H2)

        # Display the main output of the hole (surface, height...)
        self.comp_output()

        # Connect the signal
        self.lf_W0.editingFinished.connect(self.set_W0)
        self.lf_W3.editingFinished.connect(self.set_W3)
        self.lf_H0.editingFinished.connect(self.set_H0)
        self.lf_H1.editingFinished.connect(self.set_H1)
        self.lf_H2.editingFinished.connect(self.set_H2)
Exemplo n.º 39
0
    def __init__(self, image_path, background_color):
        QWidget.__init__(self)

        self.background_color = background_color
        self.load_image(image_path)
Exemplo n.º 40
0
    def __init__(self):

        QWidget.__init__(self)
Exemplo n.º 41
0
 def __init__(self, parent, svg_path):
     QWidget.__init__(self, parent)
     self.svg = QSvgWidget(self)
     self.svg.load(svg_path)
     self.setFocusPolicy(Qt.NoFocus)
 def __init__(self):
     QWidget.__init__(self, flags=Qt.Widget)
     self.stk_w = QStackedWidget(self)
     self.init_widget()
Exemplo n.º 43
0
    def __init__(self, theParent, theProject):
        QWidget.__init__(self, theParent)

        self.mainConf   = nw.CONFIG
        self.theParent  = theParent
        self.theProject = theProject

        xInd = self.mainConf.pxInt(8)

        # The Form
        self.mainForm = QGridLayout()
        self.setLayout(self.mainForm)

        self.headLabel = QLabel("<b>Project Details</b>")

        self.nameLabel = QLabel("Working title:")
        self.nameLabel.setIndent(xInd)
        self.nameValue = QLabel(self.theProject.projName)
        self.nameValue.setWordWrap(True)

        self.pathLabel = QLabel("Project path:")
        self.pathLabel.setIndent(xInd)
        self.pathValue = QLabel(self.theProject.projPath)
        self.pathValue.setWordWrap(True)
        self.pathValue.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.pathValue.setCursor(Qt.IBeamCursor)

        self.revLabel = QLabel("Revision count:")
        self.revLabel.setIndent(xInd)
        self.revValue = QLabel(f"{self.theProject.saveCount:n}")

        editHours = self.theProject.editTime/3600
        self.editLabel = QLabel("Edit time:")
        self.editLabel.setIndent(xInd)
        self.editValue = QLabel(f"{editHours:.2f} hours")

        self.statsLabel = QLabel("<b>Project Stats</b>")

        nR, nD, nF = self.theProject.projTree.countTypes()

        self.nRootLabel = QLabel("Root folders:")
        self.nRootLabel.setIndent(xInd)
        self.nRootValue = QLabel(f"{nR:n}")

        self.nDirLabel = QLabel("Folders:")
        self.nDirLabel.setIndent(xInd)
        self.nDirValue = QLabel(f"{nD:n}")

        self.nFileLabel = QLabel("Documents:")
        self.nFileLabel.setIndent(xInd)
        self.nFileValue = QLabel(f"{nF:n}")

        self.wordsLabel = QLabel("Word count:")
        self.wordsLabel.setIndent(xInd)
        self.wordsValue = QLabel(f"{self.theProject.currWCount:n}")

        self.mainForm.addWidget(self.headLabel,  0, 0, 1, 2, Qt.AlignTop)
        self.mainForm.addWidget(self.nameLabel,  1, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nameValue,  1, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.pathLabel,  2, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.pathValue,  2, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.revLabel,   3, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.revValue,   3, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.editLabel,  4, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.editValue,  4, 1, 1, 1, Qt.AlignTop)

        self.mainForm.addWidget(self.statsLabel, 5, 0, 1, 2, Qt.AlignTop)
        self.mainForm.addWidget(self.nRootLabel, 6, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nRootValue, 6, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nDirLabel,  7, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nDirValue,  7, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nFileLabel, 8, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.nFileValue, 8, 1, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.wordsLabel, 9, 0, 1, 1, Qt.AlignTop)
        self.mainForm.addWidget(self.wordsValue, 9, 1, 1, 1, Qt.AlignTop)

        self.mainForm.setVerticalSpacing(self.mainConf.pxInt(6))
        self.mainForm.setHorizontalSpacing(self.mainConf.pxInt(12))
        self.mainForm.setColumnStretch(0, 0)
        self.mainForm.setColumnStretch(1, 1)
        self.mainForm.setRowStretch(10, 1)

        return
Exemplo n.º 44
0
    def __init__(self, theParent, theProject, isStatus):
        QWidget.__init__(self, theParent)

        self.mainConf   = nw.CONFIG
        self.theParent  = theParent
        self.theProject = theProject
        self.theTheme   = theParent.theTheme
        if isStatus:
            self.theStatus = self.theProject.statusItems
        else:
            self.theStatus = self.theProject.importItems

        self.colData    = []
        self.colCounts  = []
        self.colChanged = False
        self.selColour  = None

        self.iPx = self.theTheme.baseIconSize

        self.outerBox = QVBoxLayout()
        self.mainBox  = QHBoxLayout()
        self.mainForm = QVBoxLayout()

        self.listBox = QListWidget()
        self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
        self.listBox.itemSelectionChanged.connect(self._selectedItem)
        self.listBox.model().rowsMoved.connect(self._rowsMoved)

        for iName, iCol, nUse in self.theStatus:
            self._addItem(iName, iCol, iName, nUse)

        self.editName = QLineEdit()
        self.editName.setMaxLength(40)
        self.editName.setEnabled(False)
        self.newButton  = QPushButton("New")
        self.delButton  = QPushButton("Delete")
        self.saveButton = QPushButton("Save")
        self.colPixmap  = QPixmap(self.iPx, self.iPx)
        self.colPixmap.fill(QColor(120, 120, 120))
        self.colButton  = QPushButton(QIcon(self.colPixmap), "Colour")
        self.colButton.setIconSize(self.colPixmap.rect().size())

        self.newButton.clicked.connect(self._newItem)
        self.delButton.clicked.connect(self._delItem)
        self.saveButton.clicked.connect(self._saveItem)
        self.colButton.clicked.connect(self._selectColour)

        self.mainForm.addWidget(self.newButton)
        self.mainForm.addWidget(self.delButton)
        self.mainForm.addStretch(1)
        self.mainForm.addWidget(QLabel("<b>Name</b>"))
        self.mainForm.addWidget(self.editName)
        self.mainForm.addWidget(self.colButton)
        self.mainForm.addStretch(1)
        self.mainForm.addWidget(self.saveButton)

        self.mainBox.addWidget(self.listBox)
        self.mainBox.addLayout(self.mainForm)

        if isStatus:
            self.outerBox.addWidget(QLabel("<b>Novel File Status Levels</b>"))
        else:
            self.outerBox.addWidget(QLabel("<b>Note File Importance Levels</b>"))
        self.outerBox.addLayout(self.mainBox)

        self.setLayout(self.outerBox)

        return
Exemplo n.º 45
0
    def __init__(self, parentWidget, settings):
        QWidget.__init__(self, parentWidget)

        self.settings = settings
        self.theLayout = QHBoxLayout()
        self.splitter = QSplitter(self)
        self.theLayout.addWidget(self.splitter)

        self.browserWidget = BrowserWidget(self, self.settings)
        self.browserWidget.itemSelected.connect(self.itemSelected)

        self.tabWidget = QTabWidget(self)

        tab = QWidget()

        tabLayout = QVBoxLayout(tab)
        tab.setLayout(tabLayout)

        self.editorWidget = EditorWidget(tab)

        self.editorWidget.setObjectName("EditorWidget1")
        self.editorWidget.message.connect(self.showMessage)
        self.editorWidget.titleChanged.connect(self.updateWindowTitle)
        self.editorWidget.navigate.connect(self.navigate)

        tabLayout.addWidget(self.editorWidget)
        self.editTabIdx = self.tabWidget.addTab(tab, "Edit")
        #############################

        self.browser = QWebView(self.tabWidget)
        self.browser.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.browser.linkClicked.connect(self.navigateWeb)
        self.webTabIdx = self.tabWidget.addTab(self.browser, "View web")

        self.pdfTabIdx = self.tabWidget.addTab(QWidget(self.tabWidget),
                                               "View pdf")

        self.textView = QTextEdit(self.tabWidget)
        self.textView.setReadOnly(True)
        self.textView.setFontFamily('Courier')
        self.textView.setFontPointSize(8)
        self.structureTabIdx = self.tabWidget.addTab(
            self.textView, "View document structure")

        self.customView = QTextEdit(self.tabWidget)
        self.customView.setReadOnly(True)
        self.customView.setFontFamily('Courier')
        self.customView.setFontPointSize(10)
        self.xmlTabIdx = self.tabWidget.addTab(self.customView, "View XML")

        self.htmlView = QTextEdit(self.tabWidget)
        self.htmlView.setReadOnly(True)
        self.htmlView.setFontFamily('Courier')
        self.htmlView.setFontPointSize(10)
        self.htmlTabIdx = self.tabWidget.addTab(self.htmlView, "View Html")

        self.tabWidget.currentChanged.connect(self.tabSelected)

        # Search/Links widget in lower left corner ####################################
        self.searchWidget = SearchWidget(self)
        self.searchWidget.resultSelected.connect(self.navigateDirect)

        self.toLinksWidget = LinklistWidget(self)
        self.toLinksWidget.resultSelected.connect(self.navigateDirect)

        self.fromLinksWidget = LinklistWidget(self)
        self.fromLinksWidget.resultSelected.connect(self.navigateDirect)

        self.listsWidget = QTabWidget(self)
        self.listsWidget.addTab(self.searchWidget, 'Search')
        self.listsWidget.addTab(self.toLinksWidget, 'Links to')
        self.listsWidget.addTab(self.fromLinksWidget, 'Links from')
        ###############################################################################

        leftWidget = QSplitter(Qt.Vertical, self)
        leftWidget.addWidget(self.browserWidget)
        leftWidget.addWidget(self.listsWidget)

        self.splitter.addWidget(leftWidget)
        self.splitter.addWidget(self.tabWidget)
        leftWidget.setSizes([400, 100])  # TODO

        self.setLayout(self.theLayout)
        self.splitter.setSizes([100, 400])  # TODO
        # self.splitter.setChildrenCollapsible(False)
        self.editorWidget.setEnabled(False)
Exemplo n.º 46
0
    def __init__(self, theParent, theProject):
        QWidget.__init__(self, theParent)

        self.mainConf   = nw.CONFIG
        self.theParent  = theParent
        self.theProject = theProject

        # The Form
        self.mainForm = QConfigLayout()
        self.mainForm.setHelpTextStyle(self.theParent.theTheme.helpText)
        self.setLayout(self.mainForm)

        self.mainForm.addGroupLabel("Project Settings")

        xW = self.mainConf.pxInt(250)
        xH = self.mainConf.pxInt(100)

        self.editName = QLineEdit()
        self.editName.setMaxLength(200)
        self.editName.setFixedWidth(xW)
        self.editName.setText(self.theProject.projName)
        self.mainForm.addRow(
            "Working title",
            self.editName,
            "Should be set only once."
        )

        self.editTitle = QLineEdit()
        self.editTitle.setMaxLength(200)
        self.editTitle.setFixedWidth(xW)
        self.editTitle.setText(self.theProject.bookTitle)
        self.mainForm.addRow(
            "Novel title",
            self.editTitle,
            "Change whenever you want!"
        )

        self.editAuthors = QPlainTextEdit()
        bookAuthors = ""
        for bookAuthor in self.theProject.bookAuthors:
            bookAuthors += bookAuthor+"\n"
        self.editAuthors.setPlainText(bookAuthors)
        self.editAuthors.setFixedHeight(xH)
        self.editAuthors.setFixedWidth(xW)
        self.mainForm.addRow(
            "Author(s)",
            self.editAuthors,
            "One name per line."
        )

        self.spellLang = QComboBox(self)
        theDict = self.theParent.docEditor.theDict
        self.spellLang.addItem("Default", "None")
        if theDict is not None:
            for spTag, spName in theDict.listDictionaries():
                self.spellLang.addItem(spName, spTag)

        self.mainForm.addRow(
            "Spell check language",
            self.spellLang,
            "Overrides main preferences."
        )

        if self.theProject.projLang is None:
            spellIdx = 0
        else:
            spellIdx = self.spellLang.findData(self.theProject.projLang)
        if spellIdx != -1:
            self.spellLang.setCurrentIndex(spellIdx)

        self.doBackup = QSwitch(self)
        self.doBackup.setChecked(not self.theProject.doBackup)
        self.mainForm.addRow(
            "No backup on close",
            self.doBackup,
            "Overrides main preferences."
        )

        return
Exemplo n.º 47
0
 def __init__(self, parent):
     QWidget.__init__(self, parent=parent)
     Ui_RpcConnection.__init__(self)
     self.setupUi()
Exemplo n.º 48
0
    def __init__(self, lamination=None):
        """Initialize the GUI according to current lamination

        Parameters
        ----------
        self : PWSlot18
            A PWSlot18 widget
        lamination : Lamination
            current lamination to edit
        """

        # Build the interface according to the .ui file
        QWidget.__init__(self)
        self.setupUi(self)

        self.lamination = lamination
        self.slot = lamination.slot
        # Set FloatEdit unit
        self.lf_W0.unit = "m"
        self.lf_W1.unit = "m"
        self.lf_W2.unit = "m"
        self.lf_H0.unit = "m"
        self.lf_H2.unit = "m"
        # Set unit name (m ou mm)
        wid_list = [
            self.unit_W0,
            self.unit_W1,
            self.unit_W2,
            self.unit_H0,
            self.unit_H2,
        ]
        for wid in wid_list:
            wid.setText(gui_option.unit.get_m_name())

        # Fill the fields with the machine values (if they're filled)
        self.lf_W0.setValue(self.slot.W0)
        self.lf_W1.setValue(self.slot.W1)
        self.lf_W2.setValue(self.slot.W2)
        self.lf_H0.setValue(self.slot.H0)
        if self.slot.H1_is_rad is None:
            self.slot.H1_is_rad = False
        if self.slot.H1_is_rad:
            self.lf_H1.setValue(self.slot.H1)
        else:  # convert m unit
            self.lf_H1.setValue(gui_option.unit.get_m(self.slot.H1))
        self.lf_H2.setValue(self.slot.H2)

        # Update the unit combobox with the current m unit name
        self.c_H1_unit.clear()
        self.c_H1_unit.addItems([gui_option.unit.get_m_name(), "rad", "deg"])
        if self.slot.H1_is_rad:  # rad
            self.c_H1_unit.setCurrentIndex(1)
        else:  # m
            self.c_H1_unit.setCurrentIndex(0)

        # Display the main output of the slot (surface, height...)
        self.w_out.comp_output()

        # Connect the signal
        self.lf_W0.editingFinished.connect(self.set_W0)
        self.lf_W1.editingFinished.connect(self.set_W1)
        self.lf_W2.editingFinished.connect(self.set_W2)
        self.lf_H0.editingFinished.connect(self.set_H0)
        self.lf_H1.editingFinished.connect(self.set_H1)
        self.lf_H2.editingFinished.connect(self.set_H2)
        self.c_H1_unit.currentIndexChanged.connect(self.set_H1_unit)
Exemplo n.º 49
0
    def __init__(self, lamination=None):
        """Initialize the widget according to lamination

        Parameters
        ----------
        self : PWSlot60
            A PWSlot60 widget
        lamination : Lamination
            current lamination to edit
        """

        # Build the interface according to the .ui file
        QWidget.__init__(self)
        self.setupUi(self)

        # Set FloatEdit unit
        self.lf_R1.unit = "m"
        self.lf_W1.unit = "m"
        self.lf_W2.unit = "m"
        self.lf_H1.unit = "m"
        self.lf_H2.unit = "m"
        self.lf_W3.unit = "m"
        self.lf_H3.unit = "m"
        self.lf_H4.unit = "m"

        # Set unit name (m ou mm)
        wid_list = [
            self.unit_R1,
            self.unit_W1,
            self.unit_W2,
            self.unit_H1,
            self.unit_H2,
            self.unit_W3,
            self.unit_H3,
            self.unit_H4,
        ]
        for wid in wid_list:
            wid.setText(gui_option.unit.get_m_name())

        # Setup the Widget only if the correct type is selected.
        self.lamination = lamination
        self.slot = lamination.slot

        # Fill the fields with the machine values (if they're filled)
        self.lf_R1.setValue(self.slot.R1)
        self.lf_W1.setValue(self.slot.W1)
        self.lf_W2.setValue(self.slot.W2)
        self.lf_H1.setValue(self.slot.H1)
        self.lf_H2.setValue(self.slot.H2)
        self.lf_W3.setValue(self.slot.W3)
        self.lf_H3.setValue(self.slot.H3)
        self.lf_H4.setValue(self.slot.H4)

        # Display the main output of the slot (surface, height...)
        self.comp_output()

        # Connect the signal/slot
        self.lf_R1.editingFinished.connect(self.set_R1)
        self.lf_W1.editingFinished.connect(self.set_W1)
        self.lf_W2.editingFinished.connect(self.set_W2)
        self.lf_H1.editingFinished.connect(self.set_H1)
        self.lf_H2.editingFinished.connect(self.set_H2)
        self.lf_W3.editingFinished.connect(self.set_W3)
        self.lf_H3.editingFinished.connect(self.set_H3)
        self.lf_H4.editingFinished.connect(self.set_H4)
Exemplo n.º 50
0
 def __init__(self):
     QWidget.__init__(self)
     parents_path = os.getcwd()
     self.create_txt = parents_path + "/myInfo.txt"
     self.initWidget()
Exemplo n.º 51
0
    def __init__(self,
                 header,
                 normal_icon="",
                 hovered_icon="",
                 selected_icon=""):
        QWidget.__init__(self)
        self.is_expanded = False
        self.text = header
        self.label_normal_color = self.palette().link().color().name()
        self.label_hovered_color = self.palette().highlight().color().name()
        self.label_selected_color = self.palette().highlightedText().color(
        ).name()
        self.normal_color = self.palette().base().color().name()
        self.selected_color = self.palette().highlight().color()
        self.hovered_color = self.palette().alternateBase().color()

        self.setCursor(Qt.PointingHandCursor)

        if normal_icon:
            self.normal_icon = QImage(normal_icon)
        if hovered_icon:
            self.hovered_icon = QImage(hovered_icon)
        if selected_icon:
            self.selected_icon = QImage(selected_icon)

        self.setAttribute(Qt.WA_Hover, True)

        self.color = self.normal_color
        self.setAutoFillBackground(True)

        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        self.icon = QLabel()
        self.icon.setPixmap(QPixmap.fromImage(self.normal_icon))
        self.hyper = QLabel()
        self.hyper.setText("<a style=\"color: " + self.label_normal_color +
                           " text-decoration: none\" href=\"#\">" + self.text +
                           "</a>")
        hbox.addWidget(self.icon)
        hbox.addSpacing(5)
        hbox.addWidget(self.hyper)
        hbox.addStretch()
        hbox.setContentsMargins(8, 8, 8, 8)
        vbox.addLayout(hbox)
        self.content = QWidget()
        self.content.setStyleSheet("background-color: " +
                                   self.palette().base().color().name())
        self.content.setMaximumHeight(0)

        vbox.addWidget(self.content)
        vbox.setContentsMargins(0, 0, 0, 0)
        self.setLayout(vbox)

        self.hyper.linkActivated.connect(self.buttonClicked)

        self.anim = QParallelAnimationGroup()
        self.height_anim = QPropertyAnimation(self.content,
                                              "maximumHeight".encode("utf-8"))
        self.color_anim = QPropertyAnimation(self, "color".encode("utf-8"))
        self.height_anim.setDuration(200)
        self.color_anim.setDuration(200)
        self.anim.addAnimation(self.height_anim)
        self.anim.addAnimation(self.color_anim)
Exemplo n.º 52
0
 def __init__(self):
     QWidget.__init__(self)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.model = RecordModel()
     self.ui.tableView.setModel(self.model)
Exemplo n.º 53
0
    def __init__(self):
        QWidget.__init__(self)
        self.complex_display = False

        self.hbox = QVBoxLayout()
        self.data = dat_file()
        self.my_server = server_get()
        mesh = get_mesh()
        if mesh.y.circuit_model == True and mesh.x.tot_points == 1 and mesh.z.tot_points == 1:
            self.display = circuit_editor()

            epi = get_epi()
            pos = 3
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3, "bat")
            pos = pos + 1

            for l in epi.layers:
                f = inp()
                f.load(
                    os.path.join(get_sim_path(), l.shape_electrical + ".inp"))
                component = f.get_token("#electrical_component")
                if component == "resistance":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "resistor")
                if component == "diode":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "diode")

                pos = pos + 1
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3,
                                                     "ground")
            self.display.ersatzschaltbild.objects_push()

            if inp().isfile(os.path.join(get_sim_path(),
                                         "diagram.inp")) == True:
                self.display.ersatzschaltbild.load()
        else:
            toolbar = QToolBar()
            toolbar.setIconSize(QSize(42, 42))

            spacer = QWidget()
            spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            toolbar.addWidget(spacer)

            self.tb_refresh = QAction(icon_get("view-refresh"), _("Refresh"),
                                      self)
            self.tb_refresh.triggered.connect(self.rebuild_mesh)
            toolbar.addAction(self.tb_refresh)

            self.xy = QAction(icon_get("xy"), _("xy"), self)
            self.xy.triggered.connect(self.callback_xy)
            toolbar.addAction(self.xy)

            self.yz = QAction(icon_get("yz"), _("yz"), self)
            self.yz.triggered.connect(self.callback_yz)
            toolbar.addAction(self.yz)

            self.xz = QAction(icon_get("xz"), _("xz"), self)
            self.xz.triggered.connect(self.callback_xz)
            toolbar.addAction(self.xz)

            self.tb_rotate = QAction(icon_get("rotate.png"), _("Rotate"), self)
            self.tb_rotate.triggered.connect(self.tb_rotate_click)
            toolbar.addAction(self.tb_rotate)
            self.tb_rotate.setEnabled(True)

            self.hbox.addWidget(toolbar)

            self.display = glWidget(self)
            #self.data.load(os.path.join(get_sim_path(),"electrical_mesh.dat")
            #self.display.pre_built_scene=gl_scale.project_base_objects_from_m_2_screen(self.data.data)
            self.display.draw_electrical_mesh = False
            self.display.view.draw_device = False
            self.display.enable_draw_ray_mesh = False
            self.display.enable_draw_light_source = False
            self.display.enable_draw_rays = False
            self.display.view.render_photons = False

            self.display.force_redraw()
            #global_object_register("display_mesh_recalculate",self.recalculate)

        self.hbox.addWidget(self.display)

        self.setLayout(self.hbox)
 def __init__(self):
     QWidget.__init__(self, flags=Qt.Widget)
     self.lb = QLabel()
     self.sd = QSlider(Qt.Horizontal)
     self.init_widget()
Exemplo n.º 55
0
    def __init__(self, theParent):
        QWidget.__init__(self, theParent)

        logger.debug("Initialising GuiItemDetails ...")
        self.mainConf = nw.CONFIG
        self.theParent = theParent
        self.theProject = theParent.theProject
        self.theTheme = theParent.theTheme
        self.theHandle = None

        # Sizes
        hSp = self.mainConf.pxInt(6)
        vSp = self.mainConf.pxInt(1)
        mPx = self.mainConf.pxInt(6)
        iPx = self.theTheme.baseIconSize
        fPt = self.theTheme.fontPointSize

        self.expCheck = self.theTheme.getPixmap("check", (iPx, iPx))
        self.expCross = self.theTheme.getPixmap("cross", (iPx, iPx))

        self.fntLabel = QFont()
        self.fntLabel.setBold(True)
        self.fntLabel.setPointSizeF(0.9 * fPt)

        self.fntValue = QFont()
        self.fntValue.setPointSizeF(0.9 * fPt)

        # Label
        self.labelName = QLabel(self.tr("Label"))
        self.labelName.setFont(self.fntLabel)
        self.labelName.setAlignment(Qt.AlignLeft | Qt.AlignBaseline)

        self.labelFlag = QLabel("")
        self.labelFlag.setAlignment(Qt.AlignRight | Qt.AlignBaseline)

        self.labelData = QLabel("")
        self.labelData.setFont(self.fntValue)
        self.labelData.setAlignment(Qt.AlignLeft | Qt.AlignBaseline)
        self.labelData.setWordWrap(True)

        # Status
        self.statusName = QLabel(self.tr("Status"))
        self.statusName.setFont(self.fntLabel)
        self.statusName.setAlignment(Qt.AlignLeft)

        self.statusFlag = QLabel("")
        self.statusFlag.setAlignment(Qt.AlignRight | Qt.AlignVCenter)

        self.statusData = QLabel("")
        self.statusData.setFont(self.fntValue)
        self.statusData.setAlignment(Qt.AlignLeft)

        # Class
        self.className = QLabel(self.tr("Class"))
        self.className.setFont(self.fntLabel)
        self.className.setAlignment(Qt.AlignLeft)

        self.classFlag = QLabel("")
        self.classFlag.setFont(self.fntValue)
        self.classFlag.setAlignment(Qt.AlignRight)

        self.classData = QLabel("")
        self.classData.setFont(self.fntValue)
        self.classData.setAlignment(Qt.AlignLeft)

        # Layout
        self.layoutName = QLabel(self.tr("Layout"))
        self.layoutName.setFont(self.fntLabel)
        self.layoutName.setAlignment(Qt.AlignLeft)

        self.layoutFlag = QLabel("")
        self.layoutFlag.setFont(self.fntValue)
        self.layoutFlag.setAlignment(Qt.AlignRight)

        self.layoutData = QLabel("")
        self.layoutData.setFont(self.fntValue)
        self.layoutData.setAlignment(Qt.AlignLeft)

        # Character Count
        self.cCountName = QLabel("  " + self.tr("Characters"))
        self.cCountName.setFont(self.fntLabel)
        self.cCountName.setAlignment(Qt.AlignRight)

        self.cCountData = QLabel("")
        self.cCountData.setFont(self.fntValue)
        self.cCountData.setAlignment(Qt.AlignRight)

        # Word Count
        self.wCountName = QLabel("  " + self.tr("Words"))
        self.wCountName.setFont(self.fntLabel)
        self.wCountName.setAlignment(Qt.AlignRight)

        self.wCountData = QLabel("")
        self.wCountData.setFont(self.fntValue)
        self.wCountData.setAlignment(Qt.AlignRight)

        # Paragraph Count
        self.pCountName = QLabel("  " + self.tr("Paragraphs"))
        self.pCountName.setFont(self.fntLabel)
        self.pCountName.setAlignment(Qt.AlignRight)

        self.pCountData = QLabel("")
        self.pCountData.setFont(self.fntValue)
        self.pCountData.setAlignment(Qt.AlignRight)

        # Assemble
        self.mainBox = QGridLayout(self)
        self.mainBox.addWidget(self.labelName, 0, 0, 1, 1)
        self.mainBox.addWidget(self.labelFlag, 0, 1, 1, 1)
        self.mainBox.addWidget(self.labelData, 0, 2, 1, 3)

        self.mainBox.addWidget(self.statusName, 1, 0, 1, 1)
        self.mainBox.addWidget(self.statusFlag, 1, 1, 1, 1)
        self.mainBox.addWidget(self.statusData, 1, 2, 1, 1)
        self.mainBox.addWidget(self.cCountName, 1, 3, 1, 1)
        self.mainBox.addWidget(self.cCountData, 1, 4, 1, 1)

        self.mainBox.addWidget(self.className, 2, 0, 1, 1)
        self.mainBox.addWidget(self.classFlag, 2, 1, 1, 1)
        self.mainBox.addWidget(self.classData, 2, 2, 1, 1)
        self.mainBox.addWidget(self.wCountName, 2, 3, 1, 1)
        self.mainBox.addWidget(self.wCountData, 2, 4, 1, 1)

        self.mainBox.addWidget(self.layoutName, 3, 0, 1, 1)
        self.mainBox.addWidget(self.layoutFlag, 3, 1, 1, 1)
        self.mainBox.addWidget(self.layoutData, 3, 2, 1, 1)
        self.mainBox.addWidget(self.pCountName, 3, 3, 1, 1)
        self.mainBox.addWidget(self.pCountData, 3, 4, 1, 1)

        self.mainBox.setColumnStretch(0, 0)
        self.mainBox.setColumnStretch(1, 0)
        self.mainBox.setColumnStretch(2, 1)
        self.mainBox.setColumnStretch(3, 0)
        self.mainBox.setColumnStretch(4, 0)

        self.mainBox.setHorizontalSpacing(hSp)
        self.mainBox.setVerticalSpacing(vSp)
        self.mainBox.setContentsMargins(mPx, mPx, mPx, mPx)

        self.setLayout(self.mainBox)

        # Make sure the columns for flags and counts don't resize too often
        flagWidth = self.theTheme.getTextWidth("Mm", self.fntValue)
        countWidth = self.theTheme.getTextWidth("99,999", self.fntValue)
        self.mainBox.setColumnMinimumWidth(1, flagWidth)
        self.mainBox.setColumnMinimumWidth(4, countWidth)

        logger.debug("GuiItemDetails initialisation complete")

        return
Exemplo n.º 56
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self._setup()
Exemplo n.º 57
0
 def __init__(self, editor):
     QWidget.__init__(self, parent=editor)
     self.codeEditor = editor
    def __init__(self):
        QWidget.__init__(self)

        self.init_ui()
Exemplo n.º 59
0
    def __init__(self):
        QWidget.__init__(self)

        self.initUI()
Exemplo n.º 60
0
    def __init__(self, widget: QWidget = None):
        QWidget.__init__(self)

        if(not widget is None):
            self.__layout.addWidget(widget)
        self.setLayout(self.__layout)