예제 #1
0
def main():
    global win
    signal.signal(signal.SIGINT, exit)
    args = parse_arguments()
    appKey = "scudcloud.pid"
    socket = QLocalSocket()
    socket.connectToServer(appKey)
    if socket.isOpen():
        socket.close()
        socket.deleteLater()
        return 0
    socket.deleteLater()
    app = QtGui.QApplication(sys.argv)
    app.setApplicationName(Resources.APP_NAME+' Slack_SSB')
    app.setWindowIcon(QtGui.QIcon(Resources.get_path('scudcloud.png')))

    try:
        settings_path = load_settings(args.confdir)
    except:
        print("Configuration directory " + args.confdir +\
              " could not be created! Exiting...")
        raise SystemExit()
    minimized = True if args.minimized is True else None
    urgent_hint = True if args.urgent_hint is True else None

    win = sca.ScudCloud(debug=args.debug, minimized=minimized, urgent_hint=urgent_hint, settings_path=settings_path)
    app.commitDataRequest.connect(win.setForceClose, type=QtCore.Qt.DirectConnection)

    server = QLocalServer()
    server.newConnection.connect(restore)
    server.listen(appKey)
    win.restore()
    if win.minimized is None:
        win.show()
    sys.exit(app.exec_())
예제 #2
0
def main():
    global win
    signal.signal(signal.SIGINT, exit)
    args = parse_arguments()
    appKey = "scudcloud.pid"
    socket = QLocalSocket()
    socket.connectToServer(appKey)
    if socket.isOpen():
        socket.close()
        socket.deleteLater()
        return 0
    socket.deleteLater()
    app = QtGui.QApplication(sys.argv)
    app.setApplicationName(Resources.APP_NAME)
    app.setWindowIcon(QtGui.QIcon(Resources.get_path('scudcloud.png')))

    try:
        settings_path = load_settings(args.confdir)
    except:
        print("Configuration directory " + args.confdir +\
              " could not be created! Exiting...")
        raise SystemExit()
    minimized = True if args.minimized is True else None

    win = sca.ScudCloud(debug=args.debug, minimized=minimized, settings_path=settings_path)
    app.commitDataRequest.connect(win.setForceClose, type=QtCore.Qt.DirectConnection)

    server = QLocalServer()
    server.newConnection.connect(restore)
    server.listen(appKey)
    win.restore()
    if win.minimized is None:
        win.show()
    sys.exit(app.exec_())
예제 #3
0
class AcrobatProxyListener(QLocalServer):
    # Signals
    new_path = pyqtSignal(str)

    def __init__(self, parent=None):
        super(AcrobatProxyListener, self).__init__(parent)
        self.newConnection.connect(self.on_new_connection)
        self.local_socket = QLocalSocket()

    def start(self):
        success = self.listen('Acrobat-Proxy-Listener')
        print 'Listening for Acrobat paths...'
        return success

    def stop(self):
        success = self.close()
        print 'Stopped listening for Acrobat paths'
        return success

    def on_new_connection(self):
        print 'NEW CONNECTION'
        self.local_socket = self.nextPendingConnection()
        self.local_socket.readyRead.connect(self.on_ready_read)

    def on_ready_read(self):
        print 'READING...'
        data = str(self.local_socket.readAll())
        self.local_socket.close()
        self.local_socket.deleteLater()
        print 'New path:', data
        self.new_path.emit(data)
예제 #4
0
def main():
    global win
    signal.signal(signal.SIGINT, exit)
    args = parse_arguments()
    appKey = "scudcloud.pid"
    socket = QLocalSocket()
    socket.connectToServer(appKey)
    if socket.isOpen():
        socket.close()
        socket.deleteLater()
        return 0
    socket.deleteLater()
    app = QtGui.QApplication(sys.argv)
    app.setApplicationName(Resources.APP_NAME + ' Slack_SSB')
    app.setWindowIcon(QtGui.QIcon(Resources.get_path('scudcloud.png')))

    try:
        settings_path, cache_path = load_settings(args.confdir, args.cachedir)
    except:
        print("Data directories " + args.confdir + " and " + args.cachedir +
              " could not be created! Exiting...")
        raise SystemExit()
    minimized = True if args.minimized is True else None
    urgent_hint = True if args.urgent_hint is True else None

    # Let's move the CSS to cachedir to enable additional actions
    copyfile(Resources.get_path('resources.css'),
             os.path.join(cache_path, 'resources.css'))

    win = sca.ScudCloud(debug=args.debug,
                        minimized=minimized,
                        urgent_hint=urgent_hint,
                        settings_path=settings_path,
                        cache_path=cache_path)
    app.commitDataRequest.connect(win.setForceClose,
                                  type=QtCore.Qt.DirectConnection)

    server = QLocalServer()
    server.newConnection.connect(restore)
    server.listen(appKey)
    win.restore()
    if win.minimized is None:
        win.show()
    sys.exit(app.exec_())
예제 #5
0
                        self.lblfull.setCursor(
                            QCursor(QtCore.Qt.PointingHandCursor))
                    else:
                        self.lblfull.setToolTip('')
                        self.lblfull.setCursor(QCursor())


if __name__ == '__main__':
    app = QApplication(sys.argv)

    # self.qtappname = 'Tapioca'
    socket = QLocalSocket()
    socket.connectToServer('Tapioca')
    if socket.isOpen():
        socket.close
        socket.deleteLater()
        sys.exit(0)

    example = Example(app)

    socket.deleteLater()
    server = QLocalServer()
    server.newConnection.connect(example.restore)
    ok = server.listen('Tapioca')
    if not ok:
        if server.serverError() == QAbstractSocket.AddressInUseError:
            #print('Socket in use!')
            server.removeServer('Tapioca')
            ok = server.listen('Tapioca')
            if not ok:
                print('Socket trouble!')