コード例 #1
0
    def _initUI(self, path):
        """
        Initialize the window and the progress bar

        Keyword arguments:
        path -- path to the parent directory of the project
        """
        self.setGeometry(600, 400, 250, 120)
        self.setFixedSize(270, 150)
        self.setWindowTitle("Setup Progress")
        self.setWindowIcon(QtGui.QIcon(QString(path + '/images/icon.png')))
        self.value = 0
        self.proglabel = QtWidgets.QLabel(self)
        self.proglabel.setGeometry(70, 20, 150, 30)
        self.pbar = QtWidgets.QProgressBar(self)
        self.pbar.setGeometry(30, 60, 200, 25)
        self.pbar.setRange(0, self.ranged)
        self.pbar.setValue(0)
        cancelbut = QtWidgets.QPushButton("Cancel", self)
        cancelbut.move(170, 95)
        cancelbut.clicked.connect(self._buttonClicked)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.proglabel)
        layout.addWidget(self.pbar)
        layout.addWidget(cancelbut)
コード例 #2
0
    def createRequest(self, operation, request, device):
        path = o = request.url().toString()

        if path.startswith('app://') or path.startswith('lens://'):
            if path == 'app:///':
                path = 'file://' + self._uri_app_base + 'app.html'
                logger.debug('Loading app resource: {0} ({1})'.format(o, path))

            elif path.startswith('app://'):
                path = path.replace('app://', 'file://' + self._uri_app_base)
                logger.debug('Loading app resource: {0} ({1})'.format(o, path))

                # variable substitution
                path = path.replace('$backend', 'qt5')

            elif path.startswith('lens://'):
                path = path.replace('lens://', 'file://' + self._uri_lens_base)
                logger.debug('Loading lens resource: {0} ({1})'.format(
                    o, path))

                # make lens.css backend specific
                path = path.replace('lens.css', 'lens-qt5.css')

            request.setUrl(QUrl(QString(path)))

        return QNetworkAccessManager.createRequest(self, operation, request,
                                                   device)
コード例 #3
0
ファイル: arriNamer.py プロジェクト: tnk3r/arriRollRenamer
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent=None)
     self.files = str(QFileDialog.getExistingDirectory(self, "Select ARRIRAW Clip Directory"))
     self.Error = QString("")
     if self.files != "":
         self.showdialog("Set New Roll Number")
     sys.exit(0)
コード例 #4
0
	def update_statusWindow(self,  ircMessage):
		
		myQString = "!==!==! "
		myQString = myQString+str(ircMessage)
		myQString = QString(myQString)
		myQString = html.escape(myQString)
		self.statusWindow.append_channel_text(myQString+"<br>")
コード例 #5
0
ファイル: mascril.py プロジェクト: HolgerGraef/P13pt
    def write(self, data):
        """
            This uses insertPlainText (maybe in a later version HTML, so that we can change
            the colour of the output) and scrolls down to the bottom of the field. The problem
            with append() is that it puts the inserted text in its own paragraph, which is not
            good if we do not want the linefeed.
        :param data: a unicode string
        :return: nothing
        """
        # move cursor to end (in case user clicked somewhere else in the window)
        cursor = QTextCursor(self.document())
        cursor.movePosition(QTextCursor.End)
        self.setTextCursor(cursor)

        while True:  # find all carriage returns
            i = data.find('\r')
            if i >= 0:  # means we have to deal with a carriage return
                self.insertPlainText(QString(data[0:i]))
                cursor.select(QTextCursor.LineUnderCursor)
                cursor.removeSelectedText()
                data = data[i + 1:]
            else:
                break

        # insert remaining text
        self.insertPlainText(data)
        sb = self.verticalScrollBar()
        sb.setValue(sb.maximum())
コード例 #6
0
    def update_ui(self, move_point=True):
        if self.ui_mode == 'none':
            return False
        is_predict = False
        snap_qcolor = self.calibrate_color(self.user_color, self.pos)
        self.color = snap_qcolor
        self.emit(SIGNAL('update_color'),
                  QString('background-color: %s' % self.color.name()))

        if self.ui_mode == 'point':
            if move_point:
                self.uiControl.movePoint(self.pos, snap_qcolor,
                                         self.user_color, self.brushWidth)
            else:
                self.user_color, self.brushWidth, isNew = self.uiControl.addPoint(
                    self.pos, snap_qcolor, self.user_color, self.brushWidth)
                if isNew:
                    is_predict = True
                    # self.predict_color()

        if self.ui_mode == 'stroke':
            self.uiControl.addStroke(self.prev_pos, self.pos, snap_qcolor,
                                     self.user_color, self.brushWidth)
        if self.ui_mode == 'erase':
            isRemoved = self.uiControl.erasePoint(self.pos)
            if isRemoved:
                is_predict = True
                # self.predict_color()
        return is_predict
コード例 #7
0
 def set_color(self, c_rgb):
     c = QColor(c_rgb[0], c_rgb[1], c_rgb[2])
     self.user_color = c
     snap_qcolor = self.calibrate_color(c, self.pos)
     self.color = snap_qcolor
     self.emit(SIGNAL('update_color'),
               QString('background-color: %s' % self.color.name()))
     self.uiControl.update_color(snap_qcolor, self.user_color)
     self.compute_result()
コード例 #8
0
ファイル: appqt5webengine.py プロジェクト: AlexxNica/kp-lens
    def requestStarted(self, request):
        path = o = request.requestUrl().toString()
        path = path.replace('lens://', self._uri_lens_base)

        path = path.replace('lens.css', 'lens-qt5webengine.css')

        logger.debug('Loading lens resource: {0} ({1})'.format(o, path))

        request.redirect(QUrl(QString(path)))
コード例 #9
0
 def sn_getenckey(dummy=None):
     txt,ok = QInputDialog.getText(None,
         'Enter key',
         'Enter key.\nData lost if key is lost.\nSee docs. for key upgrade notes.',
     )
     if not ok:
         return
     if str(txt).startswith('v0:'):
         txt = QString(txt[3:])
     else:
         txt = g.toUnicode(txt)
     # arbitrary kludge to convert string to 256 bits - don't change
     sha = SHA.new()
     md5 = MD5.new()
     sha.update(txt.encode('utf-8'))
     md5.update(txt.encode('utf-8'))
     __ENCKEY[0] = sha.digest()[:16] + md5.digest()[:16]
     if len(__ENCKEY[0]) != 32:
         raise Exception("sn_getenckey failed to build key")
コード例 #10
0
 def _makeGUI(self):
     """Defines the GUI for the settings window."""
     self.setWindowTitle('Detanglement - Settings')
     self.setGeometry(QtCore.QRect(200, 100, 300, 400))
     self.setFixedSize(300, 400)
     self.setWindowIcon(QtGui.QIcon(QString(self.path +
                                            '/images/icon.png')))
     self.exitAction = QtWidgets.QAction('Exit', self)
     self.exitAction.setShortcut('Ctrl+Q')
     self.exitAction.triggered.connect(self._doClose)
コード例 #11
0
ファイル: mainwindow.py プロジェクト: syurskyi/Python_Topics
    def connect(self):

        self.dbroot_node.takeChildren()

        mongo = MongoClient(['localhost:27017'])
        dbnames = mongo.database_names()
        for dbname in dbnames:
            dbtree_node = QTreeWidgetItem(MainWindow.c_db_node)
            dbtree_node.setText(0, QString(dbname))
            dbtree_node.setIcon(0, QIcon('../icon/db.svg'))
            self.dbroot_node.addChild(dbtree_node)

            db = mongo.get_database(dbname)

            collections_node = \
                    QTreeWidgetItem(MainWindow.c_coll_folder_node)
            collections_node.setText(0, self.tr('collections'))
            collections_node.setIcon(0, QIcon('../icon/table.svg'))
            dbtree_node.addChild(collections_node)

            cols = db.collection_names()
            for col in cols:
                col_node = QTreeWidgetItem(MainWindow.c_coll_node)
                col_node.setText(0, QString(col))
                col_node.setIcon(0, QIcon('../icon/table.svg'))
                collections_node.addChild(col_node)

            functions_node = QTreeWidgetItem(MainWindow.c_func_folder_node)
            functions_node.setText(0, self.tr('functions'))
            functions_node.setIcon(0, QIcon('../icon/function.svg'))
            dbtree_node.addChild(functions_node)

            #funcs=db.list()
            #for func in func:
            #    func_node=QtGui.QTreeWidgetItem()
            #    func_node.setText(0,QString(func))
            #    func_node.setIcon(0,QtGui.QIcon('icon/function.svg'))
            #    functions_node.addChild(func_node)

            users_node = QTreeWidgetItem(MainWindow.c_user_folder_node)
            users_node.setText(0, self.tr('users'))
            users_node.setIcon(0, QIcon('../icon/user.svg'))
            dbtree_node.addChild(users_node)
コード例 #12
0
ファイル: TangleUI.py プロジェクト: hellerve/Detanglement
 def _setWindowStyle(self):
     """Sets the window style."""
     height = QtWidgets.QStyle.PM_TitleBarHeight
     bar = QtWidgets.QStyleOptionTitleBar()
     titleBarHeight = self.style().pixelMetric(height, bar, self)
     geometry = self.app.desktop().availableGeometry()
     geometry.setHeight(geometry.height() - (titleBarHeight))
     self.setGeometry(geometry)
     self.setWindowTitle('Detanglement Home')
     self.setWindowIcon(QtGui.QIcon(QString(self.path +
                                            '/images/icon.png')))
コード例 #13
0
    def sn_getenckey(dummy=None):
        txt,ok = QInputDialog.getText(None,
            'Enter key',
            'Enter key.\nData lost if key is lost.\nSee docs. for key upgrade notes.',
        )
        if not ok:
            return

        if str(txt).startswith('v0:'):
            txt = QString(txt[3:])
        else:
            txt = g.toUnicode(txt)

        # arbitrary kludge to convert string to 256 bits - don't change
        sha = SHA.new()
        md5 = MD5.new()
        sha.update(txt.encode('utf-8'))
        md5.update(txt.encode('utf-8'))
        __ENCKEY[0] = sha.digest()[:16] + md5.digest()[:16]
        if len(__ENCKEY[0]) != 32:
            raise Exception("sn_getenckey failed to build key")
コード例 #14
0
ファイル: appqt5webengine.py プロジェクト: AlexxNica/kp-lens
    def requestStarted(self, request):
        path = o = request.requestUrl().toString()
        if path == 'app:///':
            path = self._uri_app_base + 'app.html'
            logger.debug('Loading app resource: {0} ({1})'.format(o, path))

        elif path.startswith('app://'):
            path = path.replace('app://', self._uri_app_base)
            logger.debug('Loading app resource: {0} ({1})'.format(o, path))

            # variable substitution
            path = path.replace('$backend', 'qt5')

        request.redirect(QUrl(QString(path)))
コード例 #15
0
 def refresh(self):
     mongo=MongoClient()
     coll=mongo[self.dbname][self.collname]
     text=QString()
     for doc in coll.find():
         text.append(str(doc))
         text.append('\n')
     self.setText(text)
     mongo.close()
コード例 #16
0
def parseString(s, rx):
    """
    Function used to convert a string into a list.
    
    @param s string to be parsed (string or QString)
    @param rx regex defining the parse pattern (QRegExp)
    @return list of parsed data (list of strings)
    """
    olist = []
    qs = QString(s)
    if not qs.startsWith(' '):
        # prepare the  string to fit our pattern
        qs = qs.prepend(' ')

    pos = rx.indexIn(qs)
    while pos != -1:
        cs = unicode(rx.cap(1))
        if cs.startswith('"') or cs.startswith("'"):
            cs = cs[1:-1]
        olist.append(cs)
        pos += rx.matchedLength()
        pos = rx.indexIn(qs, pos)

    return olist
コード例 #17
0
ファイル: mainwindow.py プロジェクト: syurskyi/Python_Topics
    def refresh_collections(self, db_item):

        count = db_item.childCount()
        for index in range(count):
            child = db_item.child(index)
            if child.type() == MainWindow.c_coll_folder_node:
                children = child.takeChildren()
                mongo = MongoClient()
                dbname = str(db_item.text(0).toUtf8(), 'utf-8', 'ignore')
                db = mongo[dbname]
                coll_list = db.collection_names()
                for text in coll_list:
                    node = QTreeWidgetItem(MainWindow.c_coll_node)
                    node.setIcon(0, QIcon('../icon/table.svg'))
                    node.setText(0, QString(text))
                    child.addChild(node)
コード例 #18
0
ファイル: TangleUI.py プロジェクト: hellerve/Detanglement
    def _setupBars(self):
        """Creates the menu and its buttons. Trivial, but verbose."""
        self.homeAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + "/images/" + "home.png")), 'Home',
            self)
        self.homeAction.setShortcut('Ctrl+B')
        self.homeAction.triggered.connect(self._showHome)
        self.refreshAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + "/images/" + "refresh" + ".png")),
            'Refresh', self)
        self.refreshAction.setShortcut('F5')
        self.refreshAction.triggered.connect(self._loadSettings)
        self.settingsAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + "/images" + "setting" + "s.png")),
            'Settings', self)
        self.settingsAction.setShortcut('Ctrl+E')
        self.settingsAction.triggered.connect(self._showSettings)
        self.helpAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + "/images/" + "help.png")), 'Help',
            self)
        self.helpAction.setShortcut('Ctrl+H')
        self.helpAction.triggered.connect(self._showHelp)
        self.dbAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + '/images/' + 'add.png')),
            'Add to APIs', self)
        self.dbAction.setShortcut('Ctrl+S')
        self.dbAction.triggered.connect(self._addToDatabase)
        self.exitAction = QtWidgets.QAction(
            QtGui.QIcon(QString(self.path + '/images/' + 'exit.png')), 'Exit',
            self)
        self.exitAction.setShortcut('Ctrl+Q')
        self.exitAction.triggered.connect(self._doClose)

        self.fileMenu = self.menuBar().addMenu("File")
        self.fileMenu.addAction(self.homeAction)
        self.fileMenu.addAction(self.refreshAction)
        self.fileMenu.addAction(self.exitAction)

        self.settingsMenu = self.menuBar().addMenu("Settings")
        self.fileMenu.addAction(self.dbAction)
        self.settingsMenu.addAction(self.settingsAction)

        self.helpMenu = self.menuBar().addMenu("Help")
        self.helpMenu.addAction(self.helpAction)

        self.toolBar = self.addToolBar("Menu")
        self.toolBar.addAction(self.homeAction)
        self.toolBar.addAction(self.refreshAction)
        self.toolBar.addAction(self.settingsAction)
        self.toolBar.addAction(self.dbAction)
        self.toolBar.addAction(self.exitAction)
        self.toolBar.addAction(self.helpAction)
コード例 #19
0
	def update_editorWindow(self, ircMessage):
		#global server_outputSorter	
		
		ts = self.server_OutputSorter.sortOutput(ircMessage)	
		found = False
		
		#Quite messages are sorted elsewhere. 
		#We need to remove the messages here that are added to the window elsewehre. 
		#--- this list might become a long list, and we might need to find a better way of
		#recording if this should be generalically added. 

		print("<DEBUG>update_editorWindow:Code: "+" "+ts.get_nick()+" "+ts.get_code().lower()+" "+ts.get_channel())
		if ts.get_code() != 'QUIT' and ts.get_code() != 'PART' and ts.get_code() != 'KICK':
			try:
				if (self.channelArray[ts.get_channel().lower()] != None):
					#self.channelArray[ts.get_channel().lower()].append_channel_text(ts.get_display_string())
					self.channelArray[ts.get_channel().lower()].append_channel_ts(ts)
					found = True
				else:
					if self.channelArray[ts.get_code().lower()] != None:
						#self.channelArray[ts.get_code().lower()].append_channel_text(ts.get_display_string())
						self.channelArray[ts.get_code().lower()].append_channel_ts(ts)

						found = True
			except KeyError as e:
				print("<DEBUG>update_editorWindow:KeyError: "+ts.get_code().lower()+" "+ts.get_channel().lower()+" Error:"+ e.args[0])
				pass
		
		
	#NOTE Stauts window access need to be collected into a single method
	#	ircMessage+="\n"
			if (found == False):
				myQString = ""
				myQString = ts.get_display_string()
				myQString = QString(myQString)
				self.statusWindow.append_channel_text(myQString)	
		
		#This should stop the window from updating when scrolling
		#up and down through the channel!
		#if not self.ui.editor_Window.isHorizontalSliderPressed():

		#self.ui.editor_Window.moveCursor(11,False)
		
		del ts
コード例 #20
0
ファイル: FilterWindow.py プロジェクト: htw-inka/Detanglement
 def _makeGUI(self):
     """Defines the GUI for the filter window."""
     self.setWindowTitle('Entanglement - Please specify filters for ' +
                         self.name)
     self.setGeometry(QtCore.QRect(200, 100, 500, 500))
     self.setFixedSize(500, 500)
     self.setWindowIcon(QtGui.QIcon(QString(self.path +
                                            '/images/icon.png')))
     self.exitAction = QtWidgets.QAction('Exit', self)
     self.exitAction.setShortcut('Ctrl+Q')
     self.exitAction.triggered.connect(self.close)
     self.layout = QtWidgets.QVBoxLayout()
     timelabel = QtWidgets.QLabel(self)
     timelabel.setText("Set Time Boundaries:")
     timelayout = QtWidgets.QVBoxLayout()
     timelayout.addWidget(timelabel)
     self.layout.addLayout(timelayout)
     self.layout.addLayout(self._makeTime())
     optionslabel = QtWidgets.QLabel(self)
     optionslabel.setText("Choose filters:")
     optionslayout = QtWidgets.QVBoxLayout()
     optionslayout.addWidget(optionslabel)
     self.layout.addLayout(optionslayout)
     searchBox = QtWidgets.QLineEdit()
     searchBox.setPlaceholderText("Enter filter here")
     searchBox.textChanged.connect(self.updateFilters)
     filterlayout = QtWidgets.QVBoxLayout()
     filterlayout.addWidget(searchBox)
     self.layout.addLayout(filterlayout)
     self.layout.addLayout(self._makeOptions())
     cancelbut = QtWidgets.QPushButton("Cancel", self)
     cancelbut.move(400, 470)
     cancelbut.clicked.connect(self.close)
     applybut = QtWidgets.QPushButton("Apply", self)
     applybut.move(400, 420)
     applybut.clicked.connect(self._applyAction)
     buttons = QtWidgets.QHBoxLayout()
     buttons.addWidget(cancelbut)
     buttons.addWidget(applybut)
     self.layout.addLayout(buttons)
     self.setLayout(self.layout)
コード例 #21
0
    def set_db_and_coll(self,dbname,collname):
        self.dbname=str(dbname)
        self.collname=str(collname)

        print(self.dbname)
        print(self.collname)

        mongo=MongoClient()
        db = mongo[self.dbname]
        coll=db[self.collname]

        text=QString()
        for doc in coll.find():
            text.append(str(doc))
            text.append('\n')
        self.setText(text)
        mongo.close()
コード例 #22
0
    def append_channel_text(self, myString):
        myQString = QString(str(myString))
        showTime = "True"
        #self.ui.editor_Window.append(myQString)
        #try:
        #	showTime=self.config.get("Channel_Settings", "Time")
        #except:
        #	self.config.add_section("Channel_Settings")
        #	self.config.set("Channel_Settings","Time", "True")
        #	showTime="True"

        if showTime == "True":
            current_time = strftime("%H:%M")
            myQString = "[" + current_time + "] " + myQString

        self.ui.editor_Window.insertHtml(myQString + "<br>")

        #This should stop the window from updating when scrolling			#up and down through the channel!
        #		if not self.ui.editor_Window.isHorizontalSliderPressed():

        self.ui.editor_Window.moveCursor(11, False)

        del myQString
コード例 #23
0
ファイル: createcoll.py プロジェクト: syurskyi/Python_Topics
 def cancel(self):
     print('cancel')
     self.coll_name_edit.setText(QString())
コード例 #24
0
 def readStdOutput(self):
     output = QString(self.process.readAllStandardOutput())
     self.sendOutput.emit(output)
コード例 #25
0
 def set_server(self, server):
     self.server = server
     mongo = MongoClient(self.server)
     output = json.dumps(mongo.server_info(), indent=4)
     self.txt_info.setText(QString(output))
     mongo.close()
コード例 #26
0
ファイル: textedit.py プロジェクト: hubitor/GROM
    def __init__(self, filename=None, parent=None):
        """
        Creates an Instance of QPlainTextEdit

         Args:
             filename (str): for opening a parameter file
             parent  (object)

        """
        super(TextEdit, self).__init__(parent)
        self.parent = parent

        self.setAttribute(Qt.WA_DeleteOnClose)

        self.filename = filename  # VIT

        print('self.filename is ---->>>> ', self.filename)
        if self.filename == None:
            self.filename = QString("Unnamed-{0}.mdp".format(TextEdit.NextId))
            TextEdit.NextId += 1
        self.document().setModified(False)

        self.setLineWrapMode(QPlainTextEdit.NoWrap)

        self.setWindowTitle(QFileInfo(self.filename).fileName())

        font = QFont("Courier", 11)
        self.document().setDefaultFont(font)
        self.setFont(font)
        self.setAutoFillBackground(False)
        self.setStyleSheet(
            "QPlainTextEdit { background-color: rgb(30, 30, 30); color: rgb(154, 190, 154);}"
        )

        #: Creates Syntax Highlighter and Find Replace Object for current Widget
        self.highlighter = GROMHighlighter(self.document())
        self.frTextObject = frTextObject(self)
        self.initDict()

        self.extraSelections = [
            [], []
        ]  # [0] for selected Line, [1] for Search Results

        #: ---> Signals Start
        self.textChanged.connect(self.updateWindowTitle)
        self.customDataChanged.connect(self.updateFileTemp)

        self.textChanged.connect(self.updateSearchText)
        self.blockCountChanged.connect(self.updateLineNumberAreaWidth)

        self.updateRequest.connect(self.updateLineNumberArea)

        self.cursorPositionChanged.connect(self.highlightCurrentLine)
        ##: ---> Signals End

        self.lineNumberArea = LineNumberArea(self)
        self.updateLineNumberAreaWidth(0)

        self.errorPos = None
        self.highlightCurrentLine()  # Need to fix this part

        self.keylist = []
コード例 #27
0
 def emit_js(self, name, *args):
     self._frame.evaluateJavaScript(
         QString(self._javascript % json.dumps([name] + list(args))))
コード例 #28
0
 def set_title(self, title):
     self._lensview.setWindowTitle(QString(title))