Exemplo n.º 1
0
    def on_normalizationComboBoxChanged(self):
        selection = str(self.normalizationComboBox.currentText())
        if selection == "No Normalization":
            self.normalizationMethod = 0
        elif selection == "Change range from":
            self.normalizationMethod = 1
        elif selection == "Auto Normalization":
            self.normalizationMethod = 2 #Currently not implemented
        
        p = QPalette()
        if self.normalizationMethod == 0:
            p.setColor(QPalette.Base,Qt.gray)
            p.setColor(QPalette.Text,Qt.gray)
            
            self.inputValueRange.setPalette(p)
            self.inputValueRange.setEnabled(False)
            self.outputValueRange.setPalette(p)
            self.outputValueRange.setEnabled(False)

        else:
            self.setLayerValueRangeInfo()
            p.setColor(QPalette.Base,Qt.white)
            p.setColor(QPalette.Text,Qt.black)
            self.inputValueRange.setPalette(p)
            self.inputValueRange.setEnabled(True)
            self.outputValueRange.setPalette(p)
            self.outputValueRange.setEnabled(True)

        
        self.validateInputValueRange()
Exemplo n.º 2
0
def test_gui_cv():
    sleep(1)
    import threading
    import sys
    import os
    import logging

    from setting import config
    from setting.configs.tool import update_config_by_name, SAFE_ARGVS
    from .testcases import knife_into_cv

    project_name = "cvoffline"
    config_info = update_config_by_name(project_name)
    config.SIMULATOR_IMG_SERVER_COFIG = [
        "127.0.0.1",
        9883,
        "randomImg",
        "IMG/G652/0912R/"
    ]
    log_level = getattr(logging, config.LOG_LEVEL, logging.ERROR)
    log_dir = getattr(config, "LOG_DIR", False)
    if log_dir == "print":
        logging.basicConfig(format="%(asctime)s-%(name)s-%(levelname)s-%(message)s",
                            level=log_level)
    else:
        logging.basicConfig(filename="setting\\testlog.log",
                            filemode="a", format="%(asctime)s-%(name)s-%(levelname)s-%(message)s",
                            level=log_level)
    logger = logging.getLogger(__name__)
    logger.error(config_info)

    from PyQt4.QtGui import QPalette, QColor, QApplication
    from GUI.view.view import get_view
    from GUI.controller import get_controller
    from util.loadfile import loadStyleSheet

    try:
        label = config.VIEW_LABEL  # label为AutomaticCV
        logger.error(" main info: {} {} \n{}".format(label, project_name, sys.argv[0]))
        app = QApplication(sys.argv)
        app.setStyleSheet(loadStyleSheet('main'))
        pt = QPalette()
        pt.setColor(QPalette.Background, QColor(4, 159, 241))
        app.setPalette(pt)
        controller = get_controller(label)
        view = get_view(label)
        # print view.__dict__, type(view)
        c = controller(view())
        threading.Thread(target=knife_into_cv, args=(c, app)).start()  # unittest thread insert
        c.show()
        # sys.stdout = sys.__stdout__

        sys.exit(app.exec_())

    except SystemExit:
        # print "system exit\n",sys._getframe(1).f_code
        sleep(3)

    except Exception as e:
        raise e
Exemplo n.º 3
0
 def __init__(self, parent: QWidget = None):
     ContainerWidget.__init__(self, parent)
     pal = QPalette(self.palette())
     self.setMinimumSize(250, 250)
     pal.setColor(QPalette.Background, QColor(55, 50, 47))
     self.setAutoFillBackground(True)
     self.setPalette(pal)
Exemplo n.º 4
0
    def __init__(self, parent, codigo_inicial=None):
        super(InterpreteLanas, self).__init__()
        self.ventana = parent

        self.refreshMarker = False
        self.multiline = False
        self.command = ''
        self.history = []
        self.historyIndex = -1

        self.interpreterLocals = {'raw_input': self.raw_input,
                                  'input': self.input,
                                  'sys': sys,
                                  'help': help,
                                  'ayuda': self.help}

        palette = QPalette()
        palette.setColor(QPalette.Text, QColor(0, 0, 0))
        self.setPalette(palette)

        if codigo_inicial:
            self.insertar_codigo_falso(codigo_inicial)

        self.marker()
        self.setUndoRedoEnabled(False)
        self.setContextMenuPolicy(Qt.NoContextMenu)

        self.timer_cursor = QTimer()
        self.timer_cursor.start(1000)
        self.timer_cursor.timeout.connect(self.marker_si_es_necesario)
Exemplo n.º 5
0
 def __init__(self, parent: QWidget=None):
     ContainerWidget.__init__(self, parent)
     pal = QPalette(self.palette())
     self.setMinimumSize(250, 250)
     pal.setColor(QPalette.Background, QColor(55, 50, 47))
     self.setAutoFillBackground(True)
     self.setPalette(pal)
Exemplo n.º 6
0
    def _staticDataInit(self):
        u"""
        Class initialization: building pixmaps, palettes… only once.
        """

        normalpalette = QPalette(self.palette())

        redpalette = QPalette( normalpalette )
        redpalette.setColor( QPalette.Base, QColor("#FF9D9F") )

        greenpalette = QPalette(normalpalette)
        greenpalette.setColor(QPalette.Base, QColor("#B0FF86") )
        size = QSize(16, 16)

        ServiceStatusItem.pix_n_colors = {
            ServiceStatusValues.RUNNING: (
                QPixmap(":/icons/status_on").scaled(size),
                greenpalette,
                '<b><font color="green">%s</font></b>.' % 'running'),
            ServiceStatusValues.STOPPED: (
                QPixmap(":/icons/status_off").scaled(size),
                redpalette,
                '<b><font color="red">%s</font></b>.' % 'stopped'),
            ServiceStatusValues.NOT_LOADED: (
                QPixmap(":/icons/status_na").scaled(size),
                normalpalette,
                '<b>%s</b>.' % 'not loaded'),
            ServiceStatusValues.POLLING: (
                QPixmap(":/icons/status_refresh"),
                normalpalette,
                '%s.' % 'polling')
        }
Exemplo n.º 7
0
    def __init__(self, direction):
        self.dns_lookup_id = 0  
        QDialog.__init__(self)
        self.setupUi(self)
        if (direction == 'OUT'):
            text = 'is trying to connect to'
        if (direction == 'IN'):
            text = 'is being connected to from'
        self.setWindowTitle("Leopard Flower firewall")
        self.label_text.setText(text)
        self.pushButton_allow.clicked.connect(self.allowClicked)
        self.pushButton_deny.clicked.connect(self.denyClicked)
        self.pushButton_hide.setVisible(False)
        self.tableWidget_details.setVisible(False)
        self.rejected.connect(self.escapePressed)
        self.finished.connect(self.dialogFinished)

        fullpath_text = QTableWidgetItem("Full path")
        self.tableWidget_details.setItem(0,0,fullpath_text)
        pid_text = QTableWidgetItem("Process ID")
        self.tableWidget_details.setItem(1,0,pid_text)
        remoteip_text = QTableWidgetItem("Remote IP")
        self.tableWidget_details.setItem(2,0,remoteip_text)
        remotedomain_text = QTableWidgetItem("Remote domain")
        self.tableWidget_details.setItem(3,0,remotedomain_text)
        remoteport_text = QTableWidgetItem("Remote port")
        self.tableWidget_details.setItem(4,0,remoteport_text)
        localport_text = QTableWidgetItem("Local port")
        self.tableWidget_details.setItem(5,0,localport_text)
        #make the incoming dialog stand out. It is not common to receive incoming connections
        if (direction == 'IN'):
            pal = QPalette()
            col = QColor(255, 0, 0, 127)
            pal.setColor(QPalette.Window, col)
            self.setPalette(pal)
Exemplo n.º 8
0
	def __init__(self, parent = None):
		QDialog.__init__(self, parent = parent)
		self.setWindowModality(False)
		self._open_instances.append(self)
		self.ui = UiDialog()
		self.ui.setupUi(self)
		self.parent = parent
		
		self.ui.folder_error.setVisible(False)
		palette = QPalette()
		palette.setColor(QPalette.Foreground, Qt.red)
		self.ui.folder_error.setPalette(palette)
		
		o_loaded_ascii = ReducedAsciiLoader(parent = parent,
		                                    ascii_file_name = '',
		                                    is_live_reduction = True)
		if parent.o_stitching_ascii_widget is None:
			o_stitching_ascii_widget = StitchingAsciiWidget(parent = self.parent,
			                                                loaded_ascii = o_loaded_ascii)
			parent.o_stitching_ascii_widget = o_stitching_ascii_widget
		
		# retrieve gui parameters 
		_export_stitching_ascii_settings = ExportStitchingAsciiSettings()
		self.dq0 = str(_export_stitching_ascii_settings.fourth_column_dq0)
		self.dq_over_q = str(_export_stitching_ascii_settings.fourth_column_dq_over_q)
		self.is_with_4th_column_flag = bool(_export_stitching_ascii_settings.fourth_column_flag)
		self.use_lowest_error_value_flag = bool(_export_stitching_ascii_settings.use_lowest_error_value_flag)
		
		self.ui.dq0Value.setText(self.dq0)
		self.ui.dQoverQvalue.setText(self.dq_over_q)
		self.ui.output4thColumnFlag.setChecked(self.is_with_4th_column_flag)
		self.ui.usingLessErrorValueFlag.setChecked(self.use_lowest_error_value_flag)
		self.ui.usingMeanValueFalg.setChecked(not self.use_lowest_error_value_flag)
Exemplo n.º 9
0
Arquivo: gui.py Projeto: jianlins/lpfw
    def __init__(self, direction):
        self.dns_lookup_id = 0  
        QDialog.__init__(self)
        self.setupUi(self)
        if (direction == 'OUT'):
            text = 'is trying to connect to'
        if (direction == 'IN'):
            text = 'is being connected to from'
        self.setWindowTitle("Leopard Flower firewall")
        self.label_text.setText(text)
        self.pushButton_allow.clicked.connect(self.allowClicked)
        self.pushButton_deny.clicked.connect(self.denyClicked)
        self.pushButton_hide.setVisible(False)
        self.tableWidget_details.setVisible(False)
        self.rejected.connect(self.escapePressed)
        self.finished.connect(self.dialogFinished)

        fullpath_text = QTableWidgetItem("Full path")
        self.tableWidget_details.setItem(0,0,fullpath_text)
        pid_text = QTableWidgetItem("Process ID")
        self.tableWidget_details.setItem(1,0,pid_text)
        remoteip_text = QTableWidgetItem("Remote IP")
        self.tableWidget_details.setItem(2,0,remoteip_text)
        remotedomain_text = QTableWidgetItem("Remote domain")
        self.tableWidget_details.setItem(3,0,remotedomain_text)
        remoteport_text = QTableWidgetItem("Remote port")
        self.tableWidget_details.setItem(4,0,remoteport_text)
        localport_text = QTableWidgetItem("Local port")
        self.tableWidget_details.setItem(5,0,localport_text)
        #make the incoming dialog stand out. It is not common to receive incoming connections
        if (direction == 'IN'):
            pal = QPalette()
            col = QColor(255, 0, 0, 127)
            pal.setColor(QPalette.Window, col)
            self.setPalette(pal)
Exemplo n.º 10
0
    def initSubWidget(self):
        
        self.linesPath = None
        self.widthtwo = 0
        self.widthseven = 0
        self.heightone = 0
        self.heightfive = 0
        
        self.copyLabel = QLabel(self)
        self.copyLabel.setFixedWidth(400)
        self.copyLabel.setAlignment(Qt.AlignCenter)
        self.nameLabel = QLabel(self)
        self.nameLabel.setFixedWidth(400)
        self.nameLabel.setAlignment(Qt.AlignCenter)
        self.copyLabel.setFont(QFont("simhei",9))
        self.nameLabel.setFont(QFont("simhei",15))
        
        self.netLabel = QLabel(self)
        self.netLabel.setFixedWidth(800)
        self.netLabel.setFixedHeight(20)
        #self.netLabel.setAlignment(Qt.AlignLeft)
        self.netLabel.setAlignment(Qt.AlignCenter)
        self.netLabel.setText(self.tr("Can not connect to server, please check network and server address!"))
        self.netLabel.setFont(QFont("simhei",12,QFont.Bold))
        pe = QPalette()
        pe.setColor(QPalette.WindowText,Qt.red)
        self.netLabel.setPalette(pe)
        self.netLabel.hide()
        
        #self.updateTimer = QTimer(self)
        #self.connect(self.updateTimer, SIGNAL("timeout"),self.updateWidgetInfo)
        #self.updateTimer.start(10)
        
        #主窗口
        self.mainwindow = MainWindow(self)

        #关于对话框
        self.aboutWidget = AboutWidget(self)
        self.aboutWidget.hide()
        #self.showDlg = SettingWidget(self.mainwindow)
        #日志窗口
        #self.recordWidget = RecordWidget(self)
        #self.recordWidget.mythread.stop()
        #self.recordWidget.hide()

        #self.toolWidget = ToolWidget()
        #self.toolWidget.hide()

        #创建action
        #self.action_showRecord_A = QAction(self)
        #self.action_closeRecord_B = QAction(self)
        #self.action_showRecord_A.setShortcut(QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_B))
        #self.action_closeRecord_B.setShortcut(QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_C))
        #self.addAction(self.action_showRecord_A)
        #self.addAction(self.action_closeRecord_B)
        
        self.udpClient = UdpClient()
        self.connect(self.udpClient, SIGNAL("start"),self.startB)
        self.connect(self.udpClient, SIGNAL("stop"),self.stopB)
    def __init__(self, c, *args, **kwargs):
        QwtDialNeedle.__init__(self, *args, **kwargs)
        palette = QPalette()
        for i in range(QPalette.NColorGroups):  # ( int i = 0; i < QPalette.NColorGroups; i++ )
            palette.setColor(i, palette.Text, c)

        palette.setColor(QPalette.Base, QColor(0,0,0))
        self.setPalette(palette)
Exemplo n.º 12
0
    def __init__(self, container_widget=None, target_method=None):

        QWidget.__init__(self, container_widget)
        self.container_widget = container_widget
        self.target_method = target_method
        palette = QPalette(self.palette())
        palette.setColor(palette.Background, Qt.transparent)
        self.setPalette(palette)
Exemplo n.º 13
0
 def __init__(self, parent=None):
     super().__init__(parent)
     palette = QPalette(self.palette())
     palette.setColor(QPalette.Highlight, QColor(Qt.green))
     palette.setColor(QPalette.Window, QColor(Qt.red))
     self.setPalette(palette)
     self.setRange(0, self.MAX)
     self.setTextVisible(False)
     self.buffer = AverageDeque()
    def __init__(self, c, *args, **kwargs):
        QwtDialNeedle.__init__(self, *args, **kwargs)
        palette = QPalette()
        for i in range(QPalette.NColorGroups
                       ):  # ( int i = 0; i < QPalette.NColorGroups; i++ )
            palette.setColor(i, palette.Text, c)

        palette.setColor(QPalette.Base, QColor(0, 0, 0))
        self.setPalette(palette)
Exemplo n.º 15
0
 def set_palette(self, background, foreground):
     """
     Set text editor palette colors:
     background color and caret (text cursor) color
     """
     palette = QPalette()
     palette.setColor(QPalette.Base, background)
     palette.setColor(QPalette.Text, foreground)
     self.setPalette(palette)
Exemplo n.º 16
0
 def set_palette(self, background, foreground):
     """
     Set text editor palette colors:
     background color and caret (text cursor) color
     """
     palette = QPalette()
     palette.setColor(QPalette.Base, background)
     palette.setColor(QPalette.Text, foreground)
     self.setPalette(palette)
Exemplo n.º 17
0
    def change_palette(self, color):
        '''Sets the global tooltip background to the given color and initializes reset'''
        p = QPalette(self.default_palette)
        p.setColor(QPalette.All, QPalette.ToolTipBase, color)
        QToolTip.setPalette(p)

        self.timer = QTimer()
        self.timer.timeout.connect(self.try_reset_palette)
        self.timer.start(300) #short enough not to flicker a wrongly colored tooltip
Exemplo n.º 18
0
    def initUI(self):
        self.setWindowTitle('Scroll PDF and reveal another one')

        p = QPalette()
        p.setColor(QPalette.Background, QtCore.Qt.black);
        self.setPalette(p)

        self.showMaximized()
        self.show()
Exemplo n.º 19
0
 def __init__(self, text, parent=None):
     FLabel.__init__(self, text, parent)
     font = QFont()
     self.setFont(font)
     red = QColor(Qt.red)
     palette = QPalette()
     palette.setColor(QPalette.WindowText, red)
     self.setPalette(palette)
     self.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
Exemplo n.º 20
0
 def initColorStyle(self):
     self.colorStyle = Styles[self.styleIndex]                
     pal = QPalette(self.tabWidget_2.palette())
     #print pal.color(QPalette.Base).name()
     #print pal.color(QPalette.Window).name()
     pal.setColor(QPalette.Base,self.colorStyle.paper)
     pal.setColor(QPalette.Text,self.colorStyle.color)
     self.tabWidget_2.setPalette(pal)
     self.tabWidget_3.setPalette(pal)
Exemplo n.º 21
0
    def __init__(self, parent=None, **kwargs):
        super(AddonManagerWidget, self).__init__(parent, **kwargs)

        #: list of Available | Installed
        self.__items = []
        self.setLayout(QVBoxLayout())

        self.__header = QLabel(
            wordWrap=True,
            textFormat=Qt.RichText
        )
        self.__search = QLineEdit(
            placeholderText=self.tr("Filter")
        )

        self.layout().addWidget(self.__search)

        self.__view = view = QTreeView(
            rootIsDecorated=False,
            editTriggers=QTreeView.NoEditTriggers,
            selectionMode=QTreeView.SingleSelection,
            alternatingRowColors=True
        )
        self.__view.setItemDelegateForColumn(0, TristateCheckItemDelegate())
        self.layout().addWidget(view)

        self.__model = model = QStandardItemModel()
        model.setHorizontalHeaderLabels(["", "Name", "Version", "Action"])
        model.dataChanged.connect(self.__data_changed)
        proxy = QSortFilterProxyModel(
            filterKeyColumn=1,
            filterCaseSensitivity=Qt.CaseInsensitive
        )
        proxy.setSourceModel(model)
        self.__search.textChanged.connect(proxy.setFilterFixedString)

        view.setModel(proxy)
        view.selectionModel().selectionChanged.connect(
            self.__update_details
        )
        header = self.__view.header()
        header.setResizeMode(0, QHeaderView.Fixed)
        header.setResizeMode(2, QHeaderView.ResizeToContents)

        self.__details = QTextBrowser(
            frameShape=QTextBrowser.NoFrame,
            readOnly=True,
            lineWrapMode=QTextBrowser.WidgetWidth,
            openExternalLinks=True,
        )

        self.__details.setWordWrapMode(QTextOption.WordWrap)
        palette = QPalette(self.palette())
        palette.setColor(QPalette.Base, Qt.transparent)
        self.__details.setPalette(palette)
        self.layout().addWidget(self.__details)
Exemplo n.º 22
0
	def __init__(self, rightVal, topVal, line_packet, mainWinObj, cmdIndex, infoArray): 
		QWidget.__init__(self)
		self.ui = Ui_consoleWidget()
		self.ui.setupUi(self)
		self.setGeometry(QRect(rightVal + 1, topVal, varlisting.CMDCONSOLE_WIDTH, varlisting.CMDCONSOLE_HEIGHT))
		self.setWindowFlags(Qt.FramelessWindowHint)
		self.setAttribute(Qt.WA_TranslucentBackground)
		self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_default.png'))

		self.ui.btn_setcmd = ExtendedQLabel(self)
		self.ui.btn_setcmd.setPixmap(QPixmap(getcwd() + '/lib/images/btn_setcmd.png'))
		self.ui.btn_setcmd.setGeometry(QRect(272, 345, 38, 18))
		self.ui.btn_setcmd.setObjectName('btn_setcmd')
		QObject.connect(self.ui.btn_setcmd, SIGNAL('mouseEnter()'), self.changeCursor)
		QObject.connect(self.ui.btn_setcmd, SIGNAL('mouseLeave()'), self.changeCursorBack)
		QObject.connect(self.ui.btn_setcmd, SIGNAL('clicked()'), self.cmdSet)

		grblPalette = QPalette()
		#grblPalette.setColor(QPalette.Text, QColor(0, 255, 0))
		grblPalette.setColor(QPalette.Base, QColor(0, 0, 0))
		self.ui.textEdit.setPalette(grblPalette)
		QObject.connect(self.ui.textEdit, SIGNAL('textChanged()'), self.autoScroll)
		self.ui.textEdit.insertHtml(varlisting.cmdScreenInitial)
		self.line_packet = line_packet

		QObject.connect(self.ui.stackedWidget, SIGNAL('currentChanged(int)'), self.updateConsole)

		self.mainWinObj = mainWinObj

		if not cmdIndex == 'Null':			
			self.ui.stackedWidget.setCurrentIndex(cmdIndex)
			if cmdIndex == 1:
				self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_getstatus.png'))
			if cmdIndex == 2:
				self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_setrate.png'))
			if cmdIndex == 3:
				self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_disconnect.png'))
			if cmdIndex == 4:
				self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_dlall.png'))
			if cmdIndex == 5:
				self.ui.bg_cmdconsole.setPixmap(QPixmap(getcwd() + '/lib/images/bg_cmdconsole_dlspecific'))

		try:
			f = open(getcwd() + '/lib/cfg/ui_cmdconsole.cfg', 'r')
			tempIn = f.read()
			self.ui.textEdit.clear()
			self.ui.textEdit.insertHtml(str(tempIn))
			f.close()
		except IOError:
			pass

		# Re-update values received (if necessary)
		self.ui.val_totaldl.setText('%i' %infoArray[0])
		self.ui.val_numpkts.setText('%s' %infoArray[1])
		self.ui.val_availdled.setText('? / %s' %infoArray[1])
		self.ui.val_statustime.setText(infoArray[2])
Exemplo n.º 23
0
	def gyroR(self,val,status):
		palette = QPalette()
		if status:
			palette.setColor(self.highlght, self.greeny)
			self.obj.pB_Gright.setPalette(palette)
			self.obj.pB_Gright.setValue(abs(val))
			self.armb.GyrR(True)
		else:
			palette.setColor(self.highlght, self.bluey)
			self.obj.pB_Gright.setPalette(palette)
Exemplo n.º 24
0
	def gyroL(self,val,status):
		palette = QPalette()
		if status:
			palette.setColor(self.highlght, self.greeny)
			self.obj.pB_Gleft.setPalette(palette)
			self.obj.pB_Gleft.setValue(val)
			self.armb.GyrL(True)
		else:
			palette.setColor(self.highlght, self.bluey)
			self.obj.pB_Gleft.setPalette(palette)
Exemplo n.º 25
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.setMinimumSize(3 * Info.dpi, 3 * Info.dpi)
     self.setWindowTitle('OpenIris: Workspace')
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__c_widget = OIWSWidget(1, 1, self)
     self.__c_widget.setGeometry(0, 0, self.width(), self.height())
Exemplo n.º 26
0
 def setHighlighted(self, highlight):
     """ Highlight the property by changing the background color of the textfield.
     """
     p = QPalette()
     if highlight:
         p.setColor(QPalette.Active, QPalette.ColorRole(9), Qt.red)
     else:
         p.setColor(QPalette.Active, QPalette.ColorRole(9), Qt.white)
     self._lineEdit.setPalette(p)
     self._textEdit.viewport().setPalette(p)
Exemplo n.º 27
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.setMinimumSize(3 * Info.dpi, 3 * Info.dpi)
     self.setWindowTitle('OpenIris: Workspace')
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__c_widget = OIWSWidget(1, 1, self)
     self.__c_widget.setGeometry(0, 0, self.width(), self.height())
Exemplo n.º 28
0
 def setHighlighted(self,highlight):
     """ Highlight the property by changing the background color of the textfield.
     """
     p=QPalette()
     if highlight:
         p.setColor(QPalette.Active, QPalette.ColorRole(9),Qt.red)
     else:
         p.setColor(QPalette.Active, QPalette.ColorRole(9),Qt.white)
     self._lineEdit.setPalette(p)
     self._textEdit.viewport().setPalette(p)
Exemplo n.º 29
0
    def change_palette(self, color):
        """Sets the global tooltip background to the given color and initializes reset"""
        self.old_palette = QToolTip.palette()
        p = QPalette(self.old_palette)
        p.setColor(QPalette.All, QPalette.ToolTipBase, color)
        QToolTip.setPalette(p)

        self.timer = QTimer()
        self.timer.timeout.connect(self.try_reset_palette)
        self.timer.start(
            300)  #short enough not to flicker a wrongly colored tooltip
Exemplo n.º 30
0
    def __init__(self, parent=None, **kwargs):
        super(AddonManagerWidget, self).__init__(parent, **kwargs)

        self.setLayout(QVBoxLayout())

        self.__header = QLabel(
            wordWrap=True,
            textFormat=Qt.RichText
        )
        self.__search = QLineEdit(
            placeholderText=self.tr("Filter")
        )

        self.layout().addWidget(self.__search)

        self.__view = view = QTreeView(
            rootIsDecorated=False,
            editTriggers=QTreeView.NoEditTriggers,
            selectionMode=QTreeView.SingleSelection,
            alternatingRowColors=True
        )
        self.__view.setItemDelegateForColumn(0, TristateCheckItemDelegate())
        self.layout().addWidget(view)

        self.__model = model = QStandardItemModel()
        model.setHorizontalHeaderLabels(["", "Name", "Version", "Action"])
        model.dataChanged.connect(self.__data_changed)
        proxy = QSortFilterProxyModel(
            filterKeyColumn=1,
            filterCaseSensitivity=Qt.CaseInsensitive
        )
        proxy.setSourceModel(model)
        self.__search.textChanged.connect(proxy.setFilterFixedString)

        view.setModel(proxy)
        view.selectionModel().selectionChanged.connect(
            self.__update_details
        )
        header = self.__view.header()
        header.setResizeMode(0, QHeaderView.Fixed)
        header.setResizeMode(2, QHeaderView.ResizeToContents)

        self.__details = QTextBrowser(
            frameShape=QTextBrowser.NoFrame,
            readOnly=True,
            lineWrapMode=QTextBrowser.WidgetWidth,
            openExternalLinks=True,
        )

        self.__details.setWordWrapMode(QTextOption.WordWrap)
        palette = QPalette(self.palette())
        palette.setColor(QPalette.Base, Qt.transparent)
        self.__details.setPalette(palette)
        self.layout().addWidget(self.__details)
Exemplo n.º 31
0
 def __init__(self, parent):
     QToolBar.__init__(self, parent)
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__objects = []
     self.init()
     self.__type = None
     self.__mode = ViewMode
     self.__menu = None
Exemplo n.º 32
0
 def __init__(self,parent = None):
     super(TabBar,self).__init__(parent)
    
     self.hoveredTab = 0
     self.setMouseTracking(True)
     self.hasUnderLine = True
     self.textLabel = QLabel(self)
     self.setFont(QFont("Times New Roman", 15))
     palette = QPalette()
     palette.setColor(QPalette.WindowText, QColor(255,255,255))
     self.setPalette(palette)
Exemplo n.º 33
0
 def __init__(self, parent):
     QToolBar.__init__(self, parent)
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__objects = []
     self.init()
     self.__type = None
     self.__mode = ViewMode
     self.__menu = None
    def __init__(self):
        super().__init__()

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        tabs_setting = gui.tabWidget(self.controlArea)

        tab_bas = oasysgui.createTabPage(tabs_setting, "Basic Setting")
        tab_adv = oasysgui.createTabPage(tabs_setting, "Advanced Setting")

        lens_box = oasysgui.widgetBox(tab_bas, "Input Parameters", addSpace=False, orientation="vertical", height=600, width=450)

        oasysgui.lineEdit(lens_box, self, "source_plane_distance", "Source Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "image_plane_distance", "Image Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal")

        gui.separator(lens_box)

        oasysgui.lineEdit(lens_box, self, "input_diameter", "Input Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "angular_acceptance", "Angular Acceptance [deg]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "inner_diameter", "Central Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "output_diameter", "Output Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "focal_length", "Focal Length [cm]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "focus_dimension", "Approximate focus dimension [um]", labelWidth=350, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(lens_box, self, "lens_length", "Lens Total Length [cm]", labelWidth=350, valueType=float, orientation="horizontal")

        gui.separator(lens_box)

        oasysgui.lineEdit(lens_box, self, "transmittance", "Lens Transmittance [%]", labelWidth=350, valueType=float, orientation="horizontal")

        gui.separator(self.controlArea, height=80)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        button = gui.button(button_box, self, "Run Shadow/trace", callback=self.traceOpticalElement)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        button = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings)
        font = QFont(button.font())
        font.setItalic(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)
        button.setFixedWidth(100)
Exemplo n.º 35
0
 def __init__(self, x, y, text, color, parent):
     super().__init__(parent)
     self.__label = QLabel(str(text), self)
     palette = QPalette()
     if color == "white":
         palette.setColor(QPalette.Foreground, Qt.black)
         self.setStyleSheet("background-image: url(gui/assets/white_piece.png);")
     else:
         palette.setColor(QPalette.Foreground, Qt.white)
         self.setStyleSheet("background-image: url(gui/assets/black_piece.png);")
     self.__label.setPalette(palette)
     self.__label.setFixedSize(22, 22)
     self.__label.setAlignment(Qt.AlignCenter)
     self.move(x, y)
Exemplo n.º 36
0
	def __setTrueState(self):
		"""
		Sets the variable button true state.
		"""

		LOGGER.debug("> Setting variable QPushButton() to 'True' state.")
		self.__state = True

		palette = QPalette()
		palette.setColor(QPalette.Button, foundations.common.getFirstItem(self.__colors))
		self.setPalette(palette)

		self.setChecked(True)
		self.setText(foundations.common.getFirstItem(self.__labels))
Exemplo n.º 37
0
    def __init__(self, rect):
        self.doc = None
        super(PdfViewer, self).__init__(None)

        self.setWindowTitle('PDF Viewer')
        self.isBlanked = False

        p = QPalette()
        p.setColor(QPalette.Background, QtCore.Qt.black);
        self.setPalette(p)

        self.setGeometry(rect)

        self.hide()
Exemplo n.º 38
0
def create_app(arguments):

    app = QApplication(arguments)
    p = QPalette()
    p.setColor(QPalette.Window, QColor("#DDDDDD"))
    app.setPalette(p)
    keys = QStyleFactory.keys()
    # list of themes include:
    # ['Windows', 'WindowsXP', 'WindowsVista', 'Motif', 'CDE', 'Plastique', 'Cleanlooks']
    # i'm using WindowsXP
    app.setStyle(QStyleFactory.create(keys[1]))
    # app.setWindowIcon(get_qicon(general_defs['icon']))

    return app
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box=show_automatic_box)

        self.runaction = widget.OWAction("Run Shadow/Trace", self)
        self.runaction.triggered.connect(self.traceOpticalElement)
        self.addAction(self.runaction)

        #################################
        # FIX A WEIRD BEHAVIOUR AFTER DISPLAY
        # THE WIDGET: PROBABLY ON SIGNAL MANAGER
        self.dumpSettings()

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        self.button_trace = gui.button(button_box, self, "Run Shadow/Trace", callback=self.traceOpticalElement)
        font = QFont(self.button_trace.font())
        font.setBold(True)
        self.button_trace.setFont(font)
        palette = QPalette(self.button_trace.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        self.button_trace.setPalette(palette) # assign new palette
        self.button_trace.setFixedHeight(45)

        self.button_reset = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings)
        font = QFont(self.button_reset.font())
        font.setItalic(True)
        self.button_reset.setFont(font)
        palette = QPalette(self.button_reset.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        self.button_reset.setPalette(palette) # assign new palette
        self.button_reset.setFixedHeight(45)
        self.button_reset.setFixedWidth(150)

        gui.separator(self.controlArea)
        
        self.tabs_setting = gui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5)

        self.tab_bas = oasysgui.createTabPage(self.tabs_setting, "Basic Setting")
        self.tab_adv = oasysgui.createTabPage(self.tabs_setting, "Advanced Setting")

        adv_other_box = oasysgui.widgetBox(self.tab_adv, "Optional file output", addSpace=False, orientation="vertical")

        gui.comboBox(adv_other_box, self, "file_to_write_out", label="Files to write out", labelWidth=150,
                     items=["All", "Mirror", "Image", "None", "Debug (All + start.xx/end.xx)"],
                     sendSelectedValue=False, orientation="horizontal")
Exemplo n.º 40
0
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box)

        self.setFixedWidth(420)
        self.setFixedHeight(350)

        gen_box = gui.widgetBox(self.controlArea, "Energy Cirp", addSpace=True, orientation="vertical")

        button_box = oasysgui.widgetBox(gen_box, "", addSpace=False, orientation="horizontal")

        button = gui.button(button_box, self, "Generate Energy Spectrum", callback=self.generate_energy_spectrum)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette) # assign new palette
        button.setFixedHeight(45)

        gui.separator(gen_box, height=10)

        result_box = oasysgui.widgetBox(gen_box, "Energy Cirp Setting", addSpace=True, orientation="vertical")


        gui.comboBox(result_box, self, "units", label="Units", labelWidth=260,
                     items=["Energy",
                            "Wavelength"],
                     sendSelectedValue=False, orientation="horizontal")

        gui.comboBox(result_box, self, "kind_of_calculation", label="Kind of calculation", labelWidth=110,
                     items=["Energy/Wavelength = C + k*Y", "User File (Energy/Wavelength vs. Y)"],
                     sendSelectedValue=False, orientation="horizontal", callback=self.set_KindOfCalculation)

        self.kind_box_1 = oasysgui.widgetBox(result_box, "", addSpace=True, orientation="vertical", height=50)

        oasysgui.lineEdit(self.kind_box_1, self, "factor", "Proportionality factor (k) [to eV/Å]",
                                     labelWidth=240, valueType=float, orientation="horizontal")

        oasysgui.lineEdit(self.kind_box_1, self, "central_value", "Central Energy/Wavelength Value [eV/Å]",
                                     labelWidth=240, valueType=float, orientation="horizontal")

        self.kind_box_2 = oasysgui.widgetBox(result_box, "", addSpace=True, orientation="horizontal", height=50)

        self.le_user_file = oasysgui.lineEdit(self.kind_box_2, self, "user_file", "File Name",
                                     labelWidth=60, valueType=str, orientation="horizontal")

        gui.button(self.kind_box_2, self, "...", callback=self.selectUserFile)

        self.set_KindOfCalculation()
Exemplo n.º 41
0
    def validateString(self):
        string_to_validate = str(self.text())

        if self._validator is not None:
            status = self._validator.validate(string_to_validate)

            palette = QPalette()
            if not status:
                palette.setColor(self.backgroundRole(), ValidationSupport.ERROR_COLOR)
                self.setPalette(palette)
                self._validation.setValidationMessage(str(status), ValidationSupport.EXCLAMATION)
            else:
                palette.setColor(self.backgroundRole(), self._valid_color)
                self.setPalette(palette)
                self._validation.setValidationMessage("")
    def vfkFileLineEdit_textChanged(self, arg1):
        """

        :type arg1: str
        :return:
        """
        info = QFileInfo(arg1)

        if info.isFile():
            self.loadVfkButton.setEnabled(True)
            self.vfkFileLineEdit.setPalette(self.__mDefaultPalette)
        else:
            self.loadVfkButton.setEnabled(False)
            pal = QPalette(self.vfkFileLineEdit.palette())
            pal.setColor(QPalette.text(), Qt.red)
            self.vfkFileLineEdit.setPalette(pal)
Exemplo n.º 43
0
 def palette( self ):
     """
     Converts the current color data to a QPalette.
     
     :return     <QPalette>
     """
     palette = QPalette()
     
     for colorGroup, qColorGroup in self.GroupMapping.items():
         for colorRole, qColorRole in self.RoleMapping.items():
             color = self.color(colorRole, colorGroup)
             
             palette.setColor( qColorGroup,
                               qColorRole,
                               color )
     return palette
Exemplo n.º 44
0
 def __init__(self, x, y, text, color, parent):
     super().__init__(parent)
     self.__label = QLabel(str(text), self)
     palette = QPalette()
     if color == "white":
         palette.setColor(QPalette.Foreground, Qt.black)
         self.setStyleSheet(
             "background-image: url(gui/assets/white_piece.png);")
     else:
         palette.setColor(QPalette.Foreground, Qt.white)
         self.setStyleSheet(
             "background-image: url(gui/assets/black_piece.png);")
     self.__label.setPalette(palette)
     self.__label.setFixedSize(22, 22)
     self.__label.setAlignment(Qt.AlignCenter)
     self.move(x, y)
Exemplo n.º 45
0
    def validateString(self):
        """Override this to provide validation of the contained string. NOT SUPPORTED YET!"""
        string_to_validate = str(self.box_string.text())

        if self.__validator is not None:
            status = self.__validator.validate(string_to_validate)

            palette = QPalette()
            if not status:
                self.setValidationMessage(str(status), HelpedWidget.EXCLAMATION)
                palette.setColor(self.box_string.backgroundRole(), self.ERROR_COLOR)
                self.box_string.setPalette(palette)
            else:
                self.setValidationMessage("")
                palette.setColor(self.box_string.backgroundRole(), self.valid_color)
                self.box_string.setPalette(palette)
Exemplo n.º 46
0
 def __init__(self, x, y, number, color, parent):
     self.x_cord = x
     self.y_cord = y
     super().__init__(str(number), parent)
     self.color = color
     self.number = number
     palette = QPalette()
     if color == "white":
         palette.setColor(QPalette.Foreground, Qt.black)
         self.setStyleSheet("background-image: url({});".format(
             get_asset_path("white_piece.png", sep="/")))
     else:
         palette.setColor(QPalette.Foreground, Qt.white)
         self.setStyleSheet("background-image: url({});".format(
             get_asset_path("black_piece.png", sep="/")))
     self.setPalette(palette)
     self.setAlignment(Qt.AlignCenter)
     self.setFixedSize(22, 22)
Exemplo n.º 47
0
 def __init__(self, width: float, height: float, parent):
     QWidget.__init__(self, parent)
     OIDynBlock.__init__(self, width, height, parent)
     self.setMinimumSize(0.4 * Info.dpi, 0.4 * Info.dpi)
     self.__layout = QGridLayout(self)
     self.__layout.setSpacing(0)
     self.__layout.setMargin(2)
     self.setLayout(self.__layout)
     self.__toolbar = OIToolBar(self)
     self.__toolbar.setMaximumHeight(0.3 * Info.dpi)
     self.__layout.addWidget(self.__toolbar, 0, 0)
     self.__main_widget = BlockManager.get_viewer(ViewMode.Scene, self)
     pal = QPalette(self.__main_widget.palette())
     pal.setColor(self.backgroundRole(), QColor(55, 50, 47))
     self.__main_widget.setAutoFillBackground(True)
     self.__main_widget.setPalette(pal)
     self.__layout.addWidget(self.__main_widget, 1, 0)
     self.setMouseTracking(True)
Exemplo n.º 48
0
    def validateString(self):
        """Override this to provide validation of the contained string. NOT SUPPORTED YET!"""
        string_to_validate = str(self.box_string.text())

        if self.__validator is not None:
            status = self.__validator.validate(string_to_validate)

            if not status:
                self.setValidationMessage(str(status),
                                          HelpedWidget.EXCLAMATION)
                palette = QPalette()
                palette.setColor(QPalette.Text, Qt.red)
                self.box_string.setPalette(palette)
            else:
                self.setValidationMessage("")
                palette = QPalette()
                palette.setColor(QPalette.Text, Qt.black)
                self.box_string.setPalette(palette)
                self.stringBoxChanged()
Exemplo n.º 49
0
    def initGui(self):
        self.ui.inputErrorLabel.setVisible(False)
        palette = QPalette()
        palette.setColor(QPalette.Foreground, Qt.red)
        self.ui.inputErrorLabel.setPalette(palette)

        # as long as issue with routine not fixed        
        self.ui.saveAsciiButton.setVisible(False) 

        self.ui.configureTable.setColumnWidth(0,70)
        self.ui.configureTable.setColumnWidth(1,300)
        self.ui.configureTable.setColumnWidth(2,300)
        self.ui.configureTable.setColumnWidth(3,300)

        magIcon = QPixmap('../icons/magnifier.png')
        self.ui.searchLabel.setPixmap(magIcon)
        clearIcon = QIcon('../icons/clear.png')
        self.ui.clearButton.setIcon(clearIcon)
        sz = QSize(15,15)
        self.ui.clearButton.setIconSize(sz)
Exemplo n.º 50
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.setFixedSize(600, 600)
        self.label = QLabel(self)
        self.label.setFixedWidth(400)
        self.label.setFixedHeight(400)
        self.label.setAlignment(Qt.AlignCenter)
        self.label.setText(u"这个标签的长裤可以变化吗aaaaaaaa东西南北?")

        pe = QPalette()
        pe.setColor(QPalette.WindowText, Qt.red)
        # self.label.setAutoFillBackground(True)
        # pe.setColor(QPalette.Window, Qt.blue)
        # pe.setColor(QPalette.Background,Qt.blue)
        self.label.setPalette(pe)

        self.label.setFont(QFont("Roman times", 10, QFont.Bold))

        self.label.move(100, 100)
Exemplo n.º 51
0
    def init_gui(self):
        palette = QPalette()
        palette.setColor(QPalette.Foreground, Qt.red)
        if self.data.new_detector_geometry_flag:
            yrange = [0, 303]
            xrange = [0, 255]
        else:
            yrange = [0, 255]
            xrange = [0, 303]
        self.ui.error_label.setVisible(False)
        self.ui.error_label.setPalette(palette)

        self.ui.peak1_label.setVisible(False)
        self.ui.peak1_label.setPalette(palette)
        self.ui.peak2_label.setVisible(False)
        self.ui.peak2_label.setPalette(palette)
        self.ui.back1_label.setVisible(False)
        self.ui.back1_label.setPalette(palette)
        self.ui.back2_label.setVisible(False)
        self.ui.back2_label.setPalette(palette)
Exemplo n.º 52
0
 def __init__(self, container, parent: QWidget = None):
     QWidget.__init__(self, parent)
     self.setWindowTitle('Container')
     self.__b_widgets = []
     self.__container = container
     self.__translation = QPoint(0, 0)
     self.setMouseTracking(True)
     self.setFocusPolicy(Qt.ClickFocus)
     self.setFocus()
     for b in container.blocks:
         w = b.get_widget(self)
         self.__b_widgets.append(w)
     pal = QPalette(self.palette())
     pal.setColor(QPalette.Background, QColor(55, 50, 47))
     self.setAutoFillBackground(True)
     self.setPalette(pal)
     container.block_added.connect(self.add_block)
     container.block_removed.connect(self.remove_block)
     self.__moving = False
     self.__origin = QPoint()
Exemplo n.º 53
0
   def createWidgets(self):
      # Create the widgets used in the main window and other parts of the script.
      
      # --- Text Area ----
      self.textArea = QTextEdit()                     # Text editor
      self.textArea.setFont(QFont("Courier", 14))     # Keepin' it simple

      # -- Console Area ---
      self.consoleArea = QTextEdit()                  # Console Area 
      consolePalette = QPalette()                     # A bit more complex
      bgColor = QColor(0, 0, 0)                       #   Green Text with  
      txColor = QColor(0, 255, 0)                     #   Black background 
      consolePalette.setColor(QPalette.Base, bgColor) # 
      consolePalette.setColor(QPalette.Text, txColor) # 
      self.consoleArea.setPalette(consolePalette)     # 
      self.consoleArea.setFont(QFont("Courier", 14))  # Font name and size
      self.consoleArea.setReadOnly(True)              # Read only  

      # --- Debug Area ---
      self.debugArea = QTextEdit()                    # Debug Area
      debugPalette = QPalette()                       # Palette for area
      bgColor = QColor(0, 0, 0)                       # Black Background 
      debugPalette.setColor(QPalette.Base, bgColor)   #
      txColor = QColor(255, 0, 0)                     # Red Text
      debugPalette.setColor(QPalette.Text, txColor)   #
      self.debugArea.setPalette(debugPalette)         #
      self.debugArea.setFont(QFont("Courier", 14))    # Font name and size
      self.debugArea.setReadOnly(True)                # Read only
   
      # --- Results Area ---
      self.resultsArea = QTextEdit()                  # Results Area
      consolePalette = QPalette()                     # A bit more complex
      bgColor = QColor(0, 0, 0)                       #   White Text with  
      txColor = QColor(255, 255, 255)                 #   Black background 
      consolePalette.setColor(QPalette.Base, bgColor) # 
      consolePalette.setColor(QPalette.Text, txColor) # 
      self.resultsArea.setPalette(consolePalette)     # 
      self.resultsArea.setFont(QFont("Courier", 10))  # Font name and size
      self.resultsArea.setReadOnly(True)              # Read only  
      
      # --- Tab Area ---  
      self.tabs = QTabWidget()                       # Tabs
      self.tabs.addTab(self.consoleArea, 'Console')  # Add Console Area tab 
      self.tabs.addTab(self.debugArea,   'Debug'  )  # Add Debug Area tab
      self.tabs.addTab(self.resultsArea, 'Results')  # Add Results Area tab
      # TODO: Change the tab indexes to meaningful words not just 0,1,2
      self.tabs.setTabIcon(0, QIcon(os.path.join(RESOURCE_PATH, "Run.png"     ))) # Add Icon to tab  
      self.tabs.setTabIcon(1, QIcon(os.path.join(RESOURCE_PATH, "Debug.png"   ))) # Add Icon to tab
      self.tabs.setTabIcon(2, QIcon(os.path.join(RESOURCE_PATH, "results.png" ))) # Add Icon to tab
      self.tabs.setIconSize(QSize(30,30))
      self.tabs.setTabShape(QTabWidget.Triangular)   # Set tab shape
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box)

        self.setFixedWidth(420)
        self.setFixedHeight(250)

        gen_box = gui.widgetBox(self.controlArea,
                                "Rotation Angle Calculator",
                                addSpace=True,
                                orientation="vertical")

        button_box = oasysgui.widgetBox(gen_box,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Calculate Rotation Angle",
                            callback=self.calculate_rotation_angle)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        result_box = oasysgui.widgetBox(gen_box,
                                        "Result",
                                        addSpace=False,
                                        orientation="horizontal")

        le_angle = oasysgui.lineEdit(result_box,
                                     self,
                                     "rotation_angle",
                                     "Calculated Rotation Angle",
                                     labelWidth=250,
                                     valueType=float,
                                     orientation="horizontal")
        le_angle.setReadOnly(True)
Exemplo n.º 55
0
	def hide_and_format_invalid_widgets(self):
		palette = QPalette()
		palette.setColor(QPalette.Foreground, Qt.red)
		self.ui.jim_peak1_label.setVisible(False)
		self.ui.jim_peak1_label.setPalette(palette)
		self.ui.jim_peak2_label.setVisible(False)
		self.ui.jim_peak2_label.setPalette(palette)
		self.ui.jim_back1_label.setVisible(False)
		self.ui.jim_back1_label.setPalette(palette)
		self.ui.jim_back2_label.setVisible(False)
		self.ui.jim_back2_label.setPalette(palette)
		self.ui.john_peak1_label.setVisible(False)
		self.ui.john_peak1_label.setPalette(palette)
		self.ui.john_peak2_label.setVisible(False)
		self.ui.john_peak2_label.setPalette(palette)
		self.ui.john_back1_label.setVisible(False)
		self.ui.john_back1_label.setPalette(palette)
		self.ui.john_back2_label.setVisible(False)
		self.ui.john_back2_label.setPalette(palette)
		self.ui.invalid_selection_label.setVisible(False)
		self.ui.invalid_selection_label.setPalette(palette)
Exemplo n.º 56
0
    def __init__(self, parent=None, log=''):
        QTextEdit.__init__(self, parent)
        console.__init__(self)
	self.completion = completion.Completion(self)
	taskmanager = TaskManager()
        self.vfs = vfs.vfs()
        self.log = log or ''
        if parent is None:
            self.eofKey = Qt.Key_D
        else:
            self.eofKey = None
        self.line    = QString()
        self.lines   = []
        self.point   = 0
        self.more    = 0
        self.reading = 0
        self.pointer = 0
        self.cursor_pos   = 0
	font = QFont("Courier")
	font.setFixedPitch(1)
	fm = QFontMetrics(font)	
       	self.fontwidth = fm.averageCharWidth()
	self.setFont(font)
        self.bgcolor = QColor("black")
        self.fgcolor = QColor("white")
        self.selcolor = QColor("green")
        pal = QPalette()
        pal.setColor(pal.Base, self.bgcolor)
        pal.setColor(pal.Text, self.fgcolor)
        self.setPalette(pal)
        self.preloop()
        self.cwd = self.vfs.getcwd()
        self.ps1 = self.cwd.path + "/" + self.cwd.name + " > "
	self.redirect = RedirectIO()
	self.sig = "Sputtext"
	self.connect(self, SIGNAL(self.sig), self.puttext)
	self.redirect.addparent(self, ["ui.gui.widget.shell", "ui.console.console", "ui.console.completion", "ui.console.line_to_arguments", "api.taskmanager.taskmanager", "api.taskmanager.scheduler", "api.taskmanager.processus"], True)
        self.write('Welcome to dff shell\n')
        self.write(self.ps1)
Exemplo n.º 57
0
    def ok(self, parent):
        palette = QPalette()
        palette.setColor(QPalette.Foreground, Qt.red)
        self.errorLabel.setPalette(palette)
        if any([not self.storageNameLine.text(), not self.passLine.text(), not self.confirmLine.text()]):
            self.errorLabel.setText("All fields are required!")
        #elif len(self.passLine.text()) < 8 or len(self.passLine.text()) > 16:
        #    self.errorLabel.setText("Password must contain 8-16 characters!")
        elif any(ch in self.storageNameLine.text() for ch in r'*|\:"<>?/'):  #TODO: to check name for linux and mac
            self.errorLabel.setText("Name has unacceptable symbols!")
        elif self.passLine.text() != self.confirmLine.text():
            self.errorLabel.setText("Password mismatch!")
        else:
            try:
                password = str(self.passLine.text())
                storage = str(self.storageNameLine.text())
                if storage in next(walk(parent.current_dir))[1]:
                    self.errorLabel.setText("Name already exist!")
                else:
                    current_dir = parent.current_dir + storage
                    mkdir(current_dir)
                    hash = SHA256.new()
                    cipher = AES.new(password+parent.padding[len(password):])
                    cipher_text = ''
                    for i in range(10*1024):
                        new_part = reduce(lambda x, y: x+y, [chr(getrandbits(8)) for _ in range(16)])
                        hash.update(new_part)
                        cipher_text += cipher.encrypt(new_part)

                    open(current_dir+sep+"init", 'wb').write(hash.hexdigest()+cipher_text)

                    parent.password = password
                    parent.selected_storage = storage
                    index = parent.model_storage.index(current_dir)
                    parent.treeViewStorage.setCurrentIndex(index)
                    self.close()
            except UnicodeError:
                self.errorLabel.setText("Password or Name has unacceptable symbols!")
Exemplo n.º 58
0
def hauptprogramm_benutzungsoberflaeche():

    'Application-Objekt instanziieren'
    app = QApplication(argv)

    'Oberflächen-Objekt instanziieren'
    win = Oberflaeche()

    'Attribute von Window setzen'
    #Größe von Window - Raspberry Pi Touchscreen Display 800 x 480 Pixel
    win.setFixedSize(QSize(800, 480))
    #Hintergrundfarbe von Window setzen - Farbe: weiß
    pal = QPalette()
    pal.setColor(QPalette.Window, QColor(255, 255, 255))
    win.setPalette(pal)
    #Schriftart und Schriftgröße von Window setzen
    win.setStyleSheet('font-size: 14px')
    #Titel von Window setzen
    win.setWindowTitle('SMfive Robotics')

    'Oberfläche öffnen'
    win.show()
    exit(app.exec_())