Exemple #1
0
 def refreshPeers(self):
     self.ui.peerList.clear()
     for peer in self.communicator.peers:
         peer = self.communicator.peers[peer]
         peerName = QListWidgetItem(self.ui.peerList)
         peerName.peer = peer
         nameFont = QtGui.QFont()
         nameFont.setPointSize(14)
         peerDetails = QListWidgetItem(self.ui.peerList)
         peerDetails.peer = peer
         detailsFont = QtGui.QFont()
         detailsFont.setPointSize(10)
         name = peer.name
         details = ""
         if peer.publicKey is None:
             details += "Unpaired, "
         else:
             details += "Paired, "
         if peer.lastKnownIP is None:
             details += "unavailable"
         else:
             details += "available: " + peer.lastKnownIP
         peerName.setFont(nameFont)
         peerName.setText(name)
         peerDetails.setFont(detailsFont)
         peerDetails.setText(details)
         self.ui.peerList.addItem(peerName)
         self.ui.peerList.addItem(peerDetails)
         separatorItem = QListWidgetItem(self.ui.peerList)
         separatorItem.guid = peer.guid
         separatorItem.peer = None
         separatorItem.setFlags(QtCore.Qt.NoItemFlags)
         self.ui.peerList.addItem(separatorItem)
Exemple #2
0
 def addHeading(self, heading):
     item = QListWidgetItem(heading)
     item.setSizeHint(QSize(10, 25))
     fnt = item.font()
     fnt.setBold(True)
     item.setFont(fnt)
     self.hostList.addItem(item)
Exemple #3
0
 def __init__(self):
     super(StatusTable, self).__init__()
     font = QFont('Times New Roman', 16)
     font.setBold(True)
     header = QListWidgetItem('Status')
     header.setFont(font)
     self.addItem(header)
     self.hide()
Exemple #4
0
    def addHeadlineMatches(self, poslist):

        for p in poslist:
            it = QListWidgetItem(p.h, self.lw)
            f = it.font()
            f.setBold(True)
            it.setFont(f)
            self.its[id(it)] = (p, None)
Exemple #5
0
    def addHeadlineMatches(self, poslist):

        for p in poslist:
            it = QListWidgetItem(p.h, self.lw)   
            f = it.font()
            f.setBold(True)
            it.setFont(f)
            self.its[id(it)] = (p,None)
Exemple #6
0
 def _create_help_item(self, image, text):
     Item = QListWidgetItem(QIcon(image), text)
     font = Item.font()
     font.setBold(True)
     Item.setSizeHint(QSize(20, 30))
     Item.setBackground(QBrush(Qt.lightGray))
     Item.setForeground(QBrush(Qt.black))
     Item.setFont(font)
     return Item
Exemple #7
0
 def _create_help_item(self, image, text):
     Item = QListWidgetItem(QIcon(image), text)
     font = Item.font()
     font.setBold(True)
     Item.setSizeHint(QSize(20, 30))
     Item.setBackground(QBrush(Qt.lightGray))
     Item.setForeground(QBrush(Qt.black))
     Item.setFont(font)
     return Item
Exemple #8
0
 def add_no_found(self):
     #Load no results found message
     noFoundItem = QListWidgetItem(
         QIcon(resources.IMAGES['delete']),
             'No results were found!')
     font = noFoundItem.font()
     font.setBold(True)
     noFoundItem.setSizeHint(QSize(20, 30))
     noFoundItem.setBackground(QBrush(Qt.lightGray))
     noFoundItem.setForeground(QBrush(Qt.black))
     noFoundItem.setFont(font)
     self.listWidget.addItem(noFoundItem)
Exemple #9
0
    def fillSourceList(self):
        """ Change dialog controls when an other calculation type selected.
        """
        # get the selected stations
        stn1 = self.ui.Station1Combo.itemData(
            self.ui.Station1Combo.currentIndex())
        stn2 = self.ui.Station2Combo.itemData(
            self.ui.Station2Combo.currentIndex())
        # clear source and target list
        self.ui.SourceList.clear()
        self.ui.TargetList.clear()
        # get tartget poins according to the stations
        targets = []
        if stn1 is not None and (self.ui.OrientRadio.isChecked() or \
                self.ui.ResectionRadio.isChecked() or self.ui.FreeRadio.isChecked()):
            targets = get_targets(stn1[0], stn1[1], stn1[2], True)
        elif stn1 is not None and self.ui.RadialRadio.isChecked():
            targets = get_targets(stn1[0], stn1[1], stn1[2], False, True)
        elif stn1 is not None and stn2 is not None and \
                self.ui.IntersectRadio.isChecked():
            # fill source list for intersection (common points)
            targets_stn1 = get_targets(stn1[0], stn1[1], stn1[2], False)
            targets_stn2 = get_targets(stn2[0], stn2[1], stn2[2], False)
            for t1 in targets_stn1:
                for t2 in targets_stn2:
                    if t1[0] == t2[0]:
                        if not t1[0] in targets:
                            targets.append([t1, t2])
                        break

        # fill source list widget
        known_list = get_known()
        if targets is not None:
            for target in targets:
                if self.ui.IntersectRadio.isChecked():
                    item = QListWidgetItem(target[0][0])
                    item.setData(Qt.UserRole, target)
                    if known_list is not None and target[0][0] in known_list:
                        itemfont = item.font()
                        itemfont.setWeight(QFont.Bold)
                        item.setFont(itemfont)
                else:
                    item = QListWidgetItem(u"%s (id:%s)" %
                                           (target[0], target[2]))
                    item.setData(Qt.UserRole, target)
                    if known_list is not None and target[0] in known_list:
                        itemfont = item.font()
                        itemfont.setWeight(QFont.Bold)
                        item.setFont(itemfont)
                self.ui.SourceList.addItem(item)
Exemple #10
0
    def addBodyMatches(self, poslist):

        for p in poslist:
            it = QListWidgetItem(p.h, self.lw)
            f = it.font()
            f.setBold(True)
            it.setFont(f)

            self.its[id(it)] = (p, None)
            ms = matchlines(p.b, p.matchiter)
            for ml, pos in ms:
                #print "ml",ml,"pos",pos
                it = QListWidgetItem(ml, self.lw)
                self.its[id(it)] = (p, pos)
Exemple #11
0
    def addBodyMatches(self, poslist):
                
        for p in poslist:
            it = QListWidgetItem(p.h, self.lw)
            f = it.font()
            f.setBold(True)
            it.setFont(f)

            self.its[id(it)] = (p, None)
            ms = matchlines(p.b, p.matchiter)
            for ml, pos in ms:
                #print "ml",ml,"pos",pos
                it = QListWidgetItem(ml, self.lw)   
                self.its[id(it)] = (p,pos)
Exemple #12
0
 def fillSourceList(self):
     """ Change dialog controls when an other calculation type selected.
     """
     # get the selected stations
     stn1 = self.ui.Station1Combo.itemData( self.ui.Station1Combo.currentIndex() )
     stn2 = self.ui.Station2Combo.itemData( self.ui.Station2Combo.currentIndex() )
     # clear source and target list
     self.ui.SourceList.clear()
     self.ui.TargetList.clear()
     # get tartget poins according to the stations
     targets = []
     if stn1 is not None and (self.ui.OrientRadio.isChecked() or \
             self.ui.ResectionRadio.isChecked() or self.ui.FreeRadio.isChecked()):
         targets = get_targets(stn1[0], stn1[1], stn1[2],True)
     elif stn1 is not None and self.ui.RadialRadio.isChecked():
         targets = get_targets(stn1[0], stn1[1], stn1[2],False,True)
     elif stn1 is not None and stn2 is not None and \
             self.ui.IntersectRadio.isChecked():
         # fill source list for intersection (common points)
         targets_stn1 = get_targets(stn1[0], stn1[1], stn1[2],False)
         targets_stn2 = get_targets(stn2[0], stn2[1], stn2[2],False)
         for t1 in targets_stn1:
             for t2 in targets_stn2:
                 if t1[0] == t2[0]:
                     if not t1[0] in targets:
                         targets.append([t1,t2])
                     break
         
     # fill source list widget
     known_list = get_known()
     if targets is not None:
         for target in targets:
             if self.ui.IntersectRadio.isChecked():
                 item = QListWidgetItem(target[0][0])
                 item.setData(Qt.UserRole,target)
                 if known_list is not None and target[0][0] in known_list:
                     itemfont = item.font()
                     itemfont.setWeight(QFont.Bold)
                     item.setFont(itemfont)
             else:
                 item = QListWidgetItem(u"%s (id:%s)"% (target[0],target[2]) )
                 item.setData(Qt.UserRole,target)
                 if known_list is not None and target[0] in known_list:
                     itemfont = item.font()
                     itemfont.setWeight(QFont.Bold)
                     item.setFont(itemfont)
             self.ui.SourceList.addItem( item )
Exemple #13
0
 def add_help(self):
     #Load help
     fileItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-file']),
             '@\t(Filter only by Files)')
     font = fileItem.font()
     font.setBold(True)
     fileItem.setSizeHint(QSize(20, 30))
     fileItem.setBackground(QBrush(Qt.lightGray))
     fileItem.setForeground(QBrush(Qt.black))
     fileItem.setFont(font)
     self.listWidget.addItem(fileItem)
     classItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-class']),
             '<\t(Filter only by Classes)')
     self.listWidget.addItem(classItem)
     classItem.setSizeHint(QSize(20, 30))
     classItem.setBackground(QBrush(Qt.lightGray))
     classItem.setForeground(QBrush(Qt.black))
     classItem.setFont(font)
     methodItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-function']),
             '>\t(Filter only by Methods)')
     self.listWidget.addItem(methodItem)
     methodItem.setSizeHint(QSize(20, 30))
     methodItem.setBackground(QBrush(Qt.lightGray))
     methodItem.setForeground(QBrush(Qt.black))
     methodItem.setFont(font)
     thisFileItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-on-this-file']),
             '.\t(Filter only by Classes and Methods in this File)')
     font = thisFileItem.font()
     font.setBold(True)
     thisFileItem.setSizeHint(QSize(20, 30))
     thisFileItem.setBackground(QBrush(Qt.lightGray))
     thisFileItem.setForeground(QBrush(Qt.black))
     thisFileItem.setFont(font)
     self.listWidget.addItem(thisFileItem)
     nonPythonItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-nonpython']),
             '!\t(Filter only by Non Python Files)')
     self.listWidget.addItem(nonPythonItem)
     nonPythonItem.setSizeHint(QSize(20, 30))
     nonPythonItem.setBackground(QBrush(Qt.lightGray))
     nonPythonItem.setForeground(QBrush(Qt.black))
     nonPythonItem.setFont(font)
    def list_compatible_canvas_layers(self):
        """Fill the list widget with compatible layers.

        :returns: Metadata of found layers.
        :rtype: list of dicts
        """
        italic_font = QtGui.QFont()
        italic_font.setItalic(True)
        list_widget = self.lstCanvasHazLayers
        # Add compatible layers
        list_widget.clear()
        for layer in self.parent.get_compatible_canvas_layers('hazard'):
            item = QListWidgetItem(layer['name'], list_widget)
            item.setData(QtCore.Qt.UserRole, layer['id'])
            if not layer['keywords']:
                item.setFont(italic_font)
            list_widget.addItem(item)
    def list_compatible_canvas_layers(self):
        """Fill the list widget with compatible layers.

        :returns: Metadata of found layers.
        :rtype: list of dicts
        """
        italic_font = QtGui.QFont()
        italic_font.setItalic(True)
        list_widget = self.lstCanvasHazLayers
        # Add compatible layers
        list_widget.clear()
        for layer in self.parent.get_compatible_canvas_layers('hazard'):
            item = QListWidgetItem(layer['name'], list_widget)
            item.setData(QtCore.Qt.UserRole, layer['id'])
            if not layer['keywords']:
                item.setFont(italic_font)
            list_widget.addItem(item)
Exemple #16
0
 def fillTargetList(self):
     """ Change Target List when an other calculation type selected.
     """
     self.ui.TargetList.clear()
     self.ui.OrderList.clear()
     # get target points
     targets = get_stations(False,False)
     # fill target list widget
     known_list = get_known()
     if targets is not None:
         for target in targets:
             item = QListWidgetItem(u"%s (%s:%s)"% (target[0],target[1],target[2]) )
             item.setData(Qt.UserRole,target)
             if known_list is not None and target[0] in known_list:
                 itemfont = item.font()
                 itemfont.setWeight(QFont.Bold)
                 item.setFont(itemfont)
             self.ui.TargetList.addItem( item )
Exemple #17
0
 def fillTargetList(self):
     """ Change Target List when an other calculation type selected.
     """
     self.ui.TargetList.clear()
     self.ui.OrderList.clear()
     # get target points
     targets = get_stations(False, False)
     # fill target list widget
     known_list = get_known()
     if targets is not None:
         for target in targets:
             item = QListWidgetItem(u"%s (%s:%s)" %
                                    (target[0], target[1], target[2]))
             item.setData(Qt.UserRole, target)
             if known_list is not None and target[0] in known_list:
                 itemfont = item.font()
                 itemfont.setWeight(QFont.Bold)
                 item.setFont(itemfont)
             self.ui.TargetList.addItem(item)
 def refreshListSlot(self, refreshChildren=True):
     seenPeers = set()
     self.ui.conversationsList.clear()
     for message in reversed(sharedData.messages):
         if not message.messagePeer in seenPeers:
             seenPeers.add(message.messagePeer)
             peerName = QListWidgetItem(self.ui.conversationsList)
             nameFont = QtGui.QFont()
             contentsFont = QtGui.QFont()
             nameFont.setPointSize(14)
             if not message.read:
                 nameFont.setBold(True)
                 contentsFont.setBold(True)
             peerName.setFont(nameFont)
             peerName.setText(message.messagePeer)
             messageContents = QListWidgetItem(self.ui.conversationsList)
             if message.isFile:
                 contentLines = [message.fileName]
             elif not message.contents:
                 contentLines = [""]
             else:
                 contentLines = message.contents.splitlines(keepends=False)
             contentsFont.setPointSize(10)
             contents = contentLines[0]
             if len(contentLines) > 1:
                 contents += "\n" + contentLines[1]
             if len(contents) > 20:
                 contents = contents[:20]
             messageContents.setFont(contentsFont)
             messageContents.setText(contents)
             self.ui.conversationsList.addItem(peerName)
             self.ui.conversationsList.addItem(messageContents)
             separatorItem = QListWidgetItem(self.ui.conversationsList)
             separatorItem.setFlags(QtCore.Qt.NoItemFlags)
             self.ui.conversationsList.addItem(separatorItem)
     if refreshChildren:
         for peerName in self.activeConversationWindows:
             self.activeConversationWindows[peerName].refreshDisplay.emit()
     self.progressStop()
 def provide(self, search):
     if not search.startswith('='):
         yield False
     if search.startswith('=='):
         if self.sympy is None:
             try:
                 import sympy
             except ImportError:
                 logging.warn('"sympy" not found.')
                 yield QListWidgetItem('"sympy" not found.')
                 yield True
             self.sympy = sympy
         locals_ = {name: getattr(self.sympy, name) for name in
                    (attribute for attribute in dir(self.sympy)
                     if not attribute.startswith('_'))}
         for variable in ('x', 'y', 'z'):
             locals_[variable] = self.sympy.var(variable)
         prettify = self.sympy_prettify
     else:
         locals_ = {name: getattr(math, name) for name in
                    (attribute for attribute in dir(math)
                     if not attribute.startswith('_'))}
         for builtin in MATH_BUILTINS:
             locals_[builtin] = getattr(__builtins__, builtin)
         prettify = str
     try:
         locals_['ans'] = self.ans
         self.ans = eval(search.lstrip('='), {'__builtins__': None},
                         locals_)
         item = QListWidgetItem(prettify(self.ans))
         item.setFlags(item.flags() & ~Qt.ItemIsSelectable)
         item.setFont(QFont(config_options['monospace font']))
         yield item
     except Exception as err:
         yield QListWidgetItem(str(err))
     yield True
Exemple #20
0
 def add_help(self):
     #Load help
     fileItem = QListWidgetItem(QIcon(resources.IMAGES['locate-file']),
                                '@\t(Filter only by Files)')
     font = fileItem.font()
     font.setBold(True)
     fileItem.setSizeHint(QSize(20, 30))
     fileItem.setBackground(QBrush(Qt.lightGray))
     fileItem.setForeground(QBrush(Qt.black))
     fileItem.setFont(font)
     self.listWidget.addItem(fileItem)
     classItem = QListWidgetItem(QIcon(resources.IMAGES['locate-class']),
                                 '<\t(Filter only by Classes)')
     self.listWidget.addItem(classItem)
     classItem.setSizeHint(QSize(20, 30))
     classItem.setBackground(QBrush(Qt.lightGray))
     classItem.setForeground(QBrush(Qt.black))
     classItem.setFont(font)
     methodItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-function']),
         '>\t(Filter only by Methods)')
     self.listWidget.addItem(methodItem)
     methodItem.setSizeHint(QSize(20, 30))
     methodItem.setBackground(QBrush(Qt.lightGray))
     methodItem.setForeground(QBrush(Qt.black))
     methodItem.setFont(font)
     attributeItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-attributes']),
         '-\t(Filter only by Attributes)')
     self.listWidget.addItem(attributeItem)
     attributeItem.setSizeHint(QSize(20, 30))
     attributeItem.setBackground(QBrush(Qt.lightGray))
     attributeItem.setForeground(QBrush(Qt.black))
     attributeItem.setFont(font)
     thisFileItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-on-this-file']),
         '.\t(Filter only by Classes and Methods in this File)')
     font = thisFileItem.font()
     font.setBold(True)
     thisFileItem.setSizeHint(QSize(20, 30))
     thisFileItem.setBackground(QBrush(Qt.lightGray))
     thisFileItem.setForeground(QBrush(Qt.black))
     thisFileItem.setFont(font)
     self.listWidget.addItem(thisFileItem)
     nonPythonItem = QListWidgetItem(
         QIcon(resources.IMAGES['locate-nonpython']),
         '!\t(Filter only by Non Python Files)')
     self.listWidget.addItem(nonPythonItem)
     nonPythonItem.setSizeHint(QSize(20, 30))
     nonPythonItem.setBackground(QBrush(Qt.lightGray))
     nonPythonItem.setForeground(QBrush(Qt.black))
     nonPythonItem.setFont(font)