Пример #1
0
 def __init__(self, argv, key):
     QtGui.QApplication.__init__(self, argv)
     self._memory = QtCore.QSharedMemory(self)
     self._memory.setKey(key)
     if self._memory.attach():
         self._running = True
     else:
         self._running = False
         if not self._memory.create(1):
             raise RuntimeError(self._memory.errorString())
Пример #2
0
    def __init__(self, parent=None):
        super(Dialog, self).__init__(parent)

        self.sharedMemory = QtCore.QSharedMemory('QSharedMemoryExample')

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        self.ui.loadFromFileButton.clicked.connect(self.loadFromFile)
        self.ui.loadFromSharedMemoryButton.clicked.connect(self.loadFromMemory)

        self.setWindowTitle("SharedMemory Example")
Пример #3
0
 def __init__(self, argv):
     QtGui.QApplication.__init__(self, argv)
     self._memory    = QtCore.QSharedMemory(self)
     self.key        = 'WiFi-Pumpkin'
     self._memory.setKey(self.key)
     self.setApplicationName(self.key)
     self.setApplicationVersion(version)
     self.setOrganizationName('P0cL4bs Team')
     self.setWindowIcon(QtGui.QIcon('icons/icon.ico'))
     self.setAppQTDesigner(self.style().objectName())
     if self._memory.attach():
         self._running = True
     else:
         self._running = False
         if not self._memory.create(1):
             raise RuntimeError(self._memory.errorString())
Пример #4
0
 def is_already_running(self):
     """
     Look to see if OpenLP is already running and ask if a 2nd instance is to be started.
     """
     self.shared_memory = QtCore.QSharedMemory('OpenLP')
     if self.shared_memory.attach():
         status = QtGui.QMessageBox.critical(
             None,
             UiStrings().Error,
             UiStrings().OpenLPStart,
             QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes
                                               | QtGui.QMessageBox.No))
         if status == QtGui.QMessageBox.No:
             return True
         return False
     else:
         self.shared_memory.create(1)
         return False
    def __init__(self, key, argv):
        super().__init__(argv)

        #set function logger
        self.log = logging.getLogger("commotion_client."+__name__)
        
        #Keep Track of main widgets, so as not to recreate them.
        self.main = False
        self.status_bar = False
        self.control_panel = False
        #Check for shared memory from other instances and if not created, create them.
        self._key = key
        self.shared_memory = QtCore.QSharedMemory(self)
        self.shared_memory.setKey(key)
        if self.shared_memory.attach():
            self._is_running = True
        else:
            self._is_running = False
            if not self.shared_memory.create(1):
                self.log.info(self.translate("logs", "Application shared memory already exists."))
                raise RuntimeError(self.shared_memory.errorString())
Пример #6
0
 def acceptReview(self):
     """ Copy image of all cells to the clipboard and then exit """
     tabController = self.get_current_tab_controller()
     currentTab = tabController.currentWidget()
     height = 0
     width = 0
     pixmaps = []
     version = -1
     if currentTab:
         (rCount, cCount) = currentTab.getDimension()
         for r in xrange(rCount):
             for c in xrange(cCount):
                 widget = currentTab.getCell(r, c)
                 if widget:
                     version = currentTab.getCellPipelineInfo(
                         r, c)[0]['version']
                     pix = widget.grabWindowPixmap()
                     pixmaps.append(pix)
                     width += pix.width()
                     height = max(height, pix.height())
     finalImage = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32)
     painter = QtGui.QPainter(finalImage)
     x = 0
     for pix in pixmaps:
         painter.drawPixmap(x, 0, pix)
         x += pix.width()
     painter.end()
     filename = tempfile.gettempdir() + '/' + 'vtexport.png'
     finalImage.save(filename, 'PNG')
     sm = QtCore.QSharedMemory('VisTrailsPipelineImage')
     sm.create(32768)
     sm.attach()
     sm.lock()
     pfn = ctypes.c_char_p(filename)
     ctypes.memmove(int(sm.data()), pfn, len(filename))
     pfn = ctypes.c_char_p(str(version))
     ctypes.memmove(int(sm.data()) + 256, pfn, len(str(version)))
     sm.unlock()
     sm.detach()
     QtCore.QCoreApplication.quit()