示例#1
0
 def __init__(self, lst, lstObjType, parent=QObject()):
     """
     A QAbstractListModel for the ListViews in the GUI that show the Users / Subreddits
     :param list: a list of genericListModelObjects (Users or Subreddits)
     :param lstObjType: the function (constructor?) to call to make a User / Subreddit
     :type lst: list
     :type lstObjType: function
     """
     super().__init__(parent)
     self.lst = lst
     self.lstObjType = lstObjType
     self.stringsInLst = set([lstObj.name.lower() for lstObj in self.lst])
示例#2
0
 def __init__(self, nx=0, ny=0, l0=0, m0=0, dl=1, dm=1, image=None):
     QwtPlotItem.__init__(self)
     # name, if any
     self.name = self.filename = None
     # internal init
     self._qo = QObject()
     self._image = self._imgminmax = None
     self._nvaluecalls = 0
     self._value_time = self._value_time0 = None
     self._lminmax = (0, 0)
     self._mminmax = (0, 0)
     self._cache_qimage = {}
     self._cache_mapping = self._cache_imap = self._cache_interp = None
     self._psfsize = 0, 0, 0
     # set image, if specified
     if image is not None:
         nx, ny = image.shape
         self.setImage(image)
     # set coordinates, if specified
     if nx and ny:
         self.setImageCoordinates(nx, ny, l0, m0, dl, dm)
     # set default colormap and intensity map
     self.colormap = Colormaps.GreyscaleColormap
     self.imap = Colormaps.LinearIntensityMap()
示例#3
0
    else:
        name = '/'.join(('', cat, name, trailer))
        caption = '<small>' + name + '</small>'
    return (name, caption)


def make_udi_caption(udi):
    """generates UDI caption (with Qt Rich Text tags) for a given UDI"""
    return make_parsed_udi_caption(*parse_udi(udi))


# ----------------------------------------------------------------------
# --- Forest state record management
# ----------------------------------------------------------------------
_forest_state = {}
_forest_state_obj = QObject()


def get_forest_state():
    """Returns current forest state."""
    global _forest_state
    return _forest_state


def request_forest_state():
    """Sends a request to the kernel to return the forest state."""
    mqs().meq('Get.Forest.State', record(), wait=False)


def subscribe_forest_state(callback):
    """Adds a subscriber to node state changes. Callback must take one