예제 #1
0
    def __init__(self, parent=None, firstTime=False):
        app = appGlobal.getApp()
        QDialog.__init__(self, parent, flags=Qt.WindowStaysOnTopHint)
        self.setFixedSize(400, 260)
        #self.setFixedWidth(400)
        self.setStyleSheet("background: white")

        if app.isWindows or app.isLinux:
            frame = QFrame(self)
            frame.setFrameShape(QFrame.Box)
            frame.setLineWidth(1)
            #frame.setFixedSize(400, height)
            frame.setFixedSize(400, 260)

            self.sizer = QVBoxLayout(frame)
        else:
            self.sizer = QVBoxLayout(self)
        self.sizer.setMargin(0)
        self.sizer.setSpacing(5)

        pm = QPixmap(os.path.join(appGlobal.getPath(), 'icons/icarra.png'))
        self.img = QLabel()
        self.img.setPixmap(pm)
        self.sizer.addWidget(self.img)

        self.sizer.addSpacing(20)
        label = QLabel("Icarra version %d.%d.%d" %
                       (appGlobal.gMajorVersion, appGlobal.gMinorVersion,
                        appGlobal.gRelease))
        label.setStyleSheet("font-weight: bold")
        self.sizer.addWidget(label, alignment=Qt.AlignCenter)
        self.sizer.addWidget(
            QLabel("<qt>&copy; 2004-2011 Jesse Liesch</qt>",
                   alignment=Qt.AlignCenter))
        self.sizer.addSpacing(20)

        label = QLabel("Developers")
        label.setStyleSheet("font-weight: bold")
        self.sizer.addWidget(label, alignment=Qt.AlignCenter)
        for name in ["Jesse Liesch", "James G Scherer"]:
            self.sizer.addWidget(QLabel(name, alignment=Qt.AlignCenter))
        self.sizer.addSpacing(30)

        # Center
        screen = app.desktop().screenGeometry()
        self.move(screen.center() - self.rect().center())

        self.exec_()
예제 #2
0
	def __init__(self, parent = None, firstTime = False):
		app = appGlobal.getApp()
		QDialog.__init__(self, parent, flags = Qt.WindowStaysOnTopHint)
		self.setFixedSize(400, 260)
		#self.setFixedWidth(400)
		self.setStyleSheet("background: white")
		
		if app.isWindows or app.isLinux:
			frame = QFrame(self)
			frame.setFrameShape(QFrame.Box)
			frame.setLineWidth(1)
			#frame.setFixedSize(400, height)
			frame.setFixedSize(400, 260)
			
			self.sizer = QVBoxLayout(frame)
		else:
			self.sizer = QVBoxLayout(self)
		self.sizer.setMargin(0)
		self.sizer.setSpacing(5)

		pm = QPixmap(os.path.join(appGlobal.getPath(), 'icons/icarra.png'))
		self.img = QLabel()
		self.img.setPixmap(pm)
		self.sizer.addWidget(self.img)
		
		self.sizer.addSpacing(20)
		label = QLabel("Icarra version %d.%d.%d" % (appGlobal.gMajorVersion, appGlobal.gMinorVersion, appGlobal.gRelease))
		label.setStyleSheet("font-weight: bold")
		self.sizer.addWidget(label, alignment = Qt.AlignCenter)
		self.sizer.addWidget(QLabel("<qt>&copy; 2004-2011 Jesse Liesch</qt>", alignment = Qt.AlignCenter))
		self.sizer.addSpacing(20)

		label = QLabel("Developers")
		label.setStyleSheet("font-weight: bold")
		self.sizer.addWidget(label, alignment = Qt.AlignCenter)
		for name in ["Jesse Liesch", "James G Scherer"]:
			self.sizer.addWidget(QLabel(name, alignment = Qt.AlignCenter))
		self.sizer.addSpacing(30)

		# Center
		screen = app.desktop().screenGeometry()
		self.move(screen.center() - self.rect().center())
		
		self.exec_()
예제 #3
0
파일: tutorial.py 프로젝트: jliesch/Icarra
    def __init__(self, tutorial):
        app = appGlobal.getApp()
        QDialog.__init__(self, None)
        self.setStyleSheet("background: white")

        self.sizer = QVBoxLayout(self)
        self.sizer.setMargin(0)

        pm = QPixmap(os.path.join(appGlobal.getPath(), "icons/icarra.png"))
        img = QLabel()
        img.setPixmap(pm)
        self.sizer.addWidget(img)
        del pm

        label = QLabel(text[tutorial])
        label.setFixedWidth(300)
        label.setWordWrap(True)
        # Labels are too small for some reason
        label.setFixedHeight(label.sizeHint().height() * 1.1)
        self.sizer.addWidget(label, alignment=Qt.AlignCenter)

        h = QHBoxLayout()
        self.sizer.addSpacing(20)
        self.sizer.addLayout(h)
        self.sizer.addSpacing(10)

        button = QPushButton("OK")
        button.setStyleSheet("background: none")
        button.setDefault(True)
        h.addStretch(1)
        h.addWidget(button, stretch=1)
        h.addStretch(1)
        self.connect(button, SIGNAL("clicked()"), SLOT("accept()"))

        # Center
        screen = app.desktop().screenGeometry()
        self.move(screen.center() - self.rect().center())

        self.exec_()
예제 #4
0
    def __init__(self, tutorial):
        app = appGlobal.getApp()
        QDialog.__init__(self, None)
        self.setStyleSheet("background: white")

        self.sizer = QVBoxLayout(self)
        self.sizer.setMargin(0)

        pm = QPixmap(os.path.join(appGlobal.getPath(), 'icons/icarra.png'))
        img = QLabel()
        img.setPixmap(pm)
        self.sizer.addWidget(img)
        del pm

        label = QLabel(text[tutorial])
        label.setFixedWidth(300)
        label.setWordWrap(True)
        # Labels are too small for some reason
        label.setFixedHeight(label.sizeHint().height() * 1.1)
        self.sizer.addWidget(label, alignment=Qt.AlignCenter)

        h = QHBoxLayout()
        self.sizer.addSpacing(20)
        self.sizer.addLayout(h)
        self.sizer.addSpacing(10)

        button = QPushButton("OK")
        button.setStyleSheet("background: none")
        button.setDefault(True)
        h.addStretch(1)
        h.addWidget(button, stretch=1)
        h.addStretch(1)
        self.connect(button, SIGNAL("clicked()"), SLOT("accept()"))

        # Center
        screen = app.desktop().screenGeometry()
        self.move(screen.center() - self.rect().center())

        self.exec_()
예제 #5
0
    def __init__(self, parent=None, firstTime=False):
        app = appGlobal.getApp()
        self.initTime = datetime.datetime.now()
        QDialog.__init__(self,
                         parent,
                         flags=Qt.WindowStaysOnTopHint | Qt.SplashScreen)
        if firstTime:
            height = 300
        else:
            height = 200
        self.setFixedSize(400, height)
        self.setStyleSheet("background: white")
        self.setModal(True)
        self.running = True

        if app.isWindows or app.isLinux:
            frame = QFrame(self)
            frame.setFrameShape(QFrame.Box)
            frame.setLineWidth(1)
            frame.setFixedSize(400, height)

            self.sizer = QVBoxLayout(frame)
        else:
            self.sizer = QVBoxLayout(self)
        self.sizer.setMargin(0)

        pm = QPixmap(os.path.join(appGlobal.getPath(), 'icons/icarra.png'))
        self.img = QLabel()
        self.img.setPixmap(pm)
        self.sizer.addWidget(self.img)

        self.sizer.addStretch(1)
        label = QLabel("Icarra version %d.%d.%d" %
                       (appGlobal.gMajorVersion, appGlobal.gMinorVersion,
                        appGlobal.gRelease))
        label.setStyleSheet("font-weight: bold")
        self.sizer.addWidget(label, alignment=Qt.AlignCenter)
        self.sizer.addWidget(
            QLabel("<qt>&copy; 2004-2011 Jesse Liesch</qt>",
                   alignment=Qt.AlignCenter))
        self.sizer.addStretch(1)

        # Add first time stuff
        if firstTime:
            label2 = QLabel(
                "Icarra is downloading stock data and configuring itself for use.  Please allow a minute for this operation to complete.  It will only happen once."
            )
            label2.setFixedWidth(300)
            label2.setWordWrap(True)
            # Labels are too small for some reason
            label2.setFixedHeight(label2.sizeHint().height() * 1.1)
            self.sizer.addSpacing(10)
            self.sizer.addWidget(label2, alignment=Qt.AlignCenter)
            self.sizer.addSpacing(10)

            label3 = QLabel("Note: You must be connected to the internet.")
            label3.setFixedWidth(300)
            label3.setWordWrap(True)
            label3.setFixedHeight(label3.sizeHint().height() * 1.1)
            self.sizer.addWidget(label3, alignment=Qt.AlignCenter)
            self.sizer.addSpacing(10)

            self.progress = QProgressBar()
            self.progress.setFixedWidth(300)
            self.progress.setValue(10)
            self.sizer.addWidget(self.progress, alignment=Qt.AlignCenter)
            self.sizer.addSpacing(20)

            self.sizer.addStretch(1)

        # Center
        screen = app.desktop().screenGeometry()
        self.move(screen.center() - self.rect().center())

        self.setCursor(Qt.WaitCursor)
        self.show()
        self.raise_()
        app.processEvents()
        self.activateWindow()

        if firstTime:
            status = 0
            self.lastRet = 0
            self.sleptOnce = False
            while status != 95 and self.running:
                # Process events for 500ms
                app.processEvents(QEventLoop.AllEvents, 500)
                status = self.checkStatus()
                self.lastRet = max(status, self.lastRet)
                status = self.lastRet
                if self.progress.value() != status:
                    self.progress.setValue(status)
예제 #6
0
    def __init__(self):
        self.plugins = {}
        self.brokerages = {}

        # Load all plugins in user plugins path
        prefsRoot = Prefs.prefsRootPath()
        sys.path.append(prefsRoot + 'plugins')
        path = os.path.join(prefsRoot, "plugins/plugin_*.py")
        for file in glob.glob(path):
            plugin = file.replace(prefsRoot + 'plugins', '')
            plugin = plugin.replace('/', '')
            plugin = plugin.replace('\\', '')
            plugin = plugin.replace('.py', '')
            __import__(plugin)
            self.plugins[plugin] = sys.modules[plugin].Plugin()
            self.plugins[plugin].builtin = False

        # Load all plugins in builtin path
        pluginPath = os.path.join(appGlobal.getPath(), 'builtinPlugins')
        sys.path.append(pluginPath)
        for file in glob.glob('builtinPlugins/plugin_*.py'):
            plugin = file.replace('builtinPlugins', '')
            plugin = plugin.replace('/', '')
            plugin = plugin.replace('\\', '')
            plugin = plugin.replace('.py', '')
            __import__(plugin)
            self.plugins[plugin] = sys.modules[plugin].Plugin()
            self.plugins[plugin].builtin = True

        # Check for duplicate names
        names = {}
        for p, plugin in self.plugins.items():
            if plugin.name() in names:
                print "Duplicate plugin name", plugin.name()
                sys.exit()
            names[plugin.name()] = True

        for p, plugin in self.plugins.items():
            plugin.initialize()

        # Check for duplicate names
        names = {}
        for p, plugin in self.plugins.items():
            if plugin.name() in names:
                print "Duplicate plugin name", plugin.name()
                sys.exit()
            names[plugin.name()] = True

        # Load all brokerages in user plugins path
        path = os.path.join(prefsRoot, "plugins/brokerage_*.py")
        for file in glob.glob(path):
            brokerage = file.replace(prefsRoot + 'plugins', '')
            brokerage = brokerage.replace('/', '')
            brokerage = brokerage.replace('\\', '')
            brokerage = brokerage.replace('.py', '')
            __import__(brokerage)
            self.brokerages[brokerage] = sys.modules[brokerage].Brokerage()
            self.brokerages[brokerage].builtin = False

        # Load all brokerages in builtin path
        for file in glob.glob('builtinPlugins/brokerage_*.py'):
            brokerage = file.replace('builtinPlugins', '')
            brokerage = brokerage.replace('/', '')
            brokerage = brokerage.replace('\\', '')
            brokerage = brokerage.replace('.py', '')
            __import__(brokerage)
            self.brokerages[brokerage] = sys.modules[brokerage].Brokerage()
            self.brokerages[brokerage].builtin = True

        # Check for duplicate names
        names = {}
        for b, brokerage in self.brokerages.items():
            if brokerage.getName() in names:
                print "Duplicate brokerage name", brokerage.getName()
                sys.exit()
            names[brokerage.getName()] = True
예제 #7
0
	def __init__(self, parent = None, firstTime = False):
		app = appGlobal.getApp()
		self.initTime = datetime.datetime.now()
		QDialog.__init__(self, parent, flags = Qt.WindowStaysOnTopHint | Qt.SplashScreen)
		if firstTime:
			height = 300
		else:
			height = 200
		self.setFixedSize(400, height)
		self.setStyleSheet("background: white")
		self.setModal(True)
		self.running = True
		
		if app.isWindows or app.isLinux:
			frame = QFrame(self)
			frame.setFrameShape(QFrame.Box)
			frame.setLineWidth(1)
			frame.setFixedSize(400, height)
			
			self.sizer = QVBoxLayout(frame)
		else:
			self.sizer = QVBoxLayout(self)
		self.sizer.setMargin(0)

		pm = QPixmap(os.path.join(appGlobal.getPath(), 'icons/icarra.png'))
		self.img = QLabel()
		self.img.setPixmap(pm)
		self.sizer.addWidget(self.img)
		
		self.sizer.addStretch(1)
		label = QLabel("Icarra version %d.%d.%d" % (appGlobal.gMajorVersion, appGlobal.gMinorVersion, appGlobal.gRelease))
		label.setStyleSheet("font-weight: bold")
		self.sizer.addWidget(label, alignment = Qt.AlignCenter)
		self.sizer.addWidget(QLabel("<qt>&copy; 2004-2011 Jesse Liesch</qt>", alignment = Qt.AlignCenter))
		self.sizer.addStretch(1)

		# Add first time stuff
		if firstTime:
			label2 = QLabel("Icarra is downloading stock data and configuring itself for use.  Please allow a minute for this operation to complete.  It will only happen once.")
			label2.setFixedWidth(300)
			label2.setWordWrap(True)
			# Labels are too small for some reason
			label2.setFixedHeight(label2.sizeHint().height() * 1.1)
			self.sizer.addSpacing(10)
			self.sizer.addWidget(label2, alignment = Qt.AlignCenter)
			self.sizer.addSpacing(10)

			label3 = QLabel("Note: You must be connected to the internet.")
			label3.setFixedWidth(300)
			label3.setWordWrap(True)
			label3.setFixedHeight(label3.sizeHint().height() * 1.1)
			self.sizer.addWidget(label3, alignment = Qt.AlignCenter)
			self.sizer.addSpacing(10)

			self.progress = QProgressBar()
			self.progress.setFixedWidth(300)
			self.progress.setValue(10)
			self.sizer.addWidget(self.progress, alignment = Qt.AlignCenter)
			self.sizer.addSpacing(20)

			self.sizer.addStretch(1)

		# Center
		screen = app.desktop().screenGeometry()
		self.move(screen.center() - self.rect().center())

  		self.setCursor(Qt.WaitCursor)
		self.show()
		self.raise_()
		app.processEvents()
		self.activateWindow()

		if firstTime:
			status = 0
			self.lastRet = 0
			self.sleptOnce = False
			while status != 95 and self.running:
				# Process events for 500ms
				app.processEvents(QEventLoop.AllEvents, 500)
				status = self.checkStatus()
				self.lastRet = max(status, self.lastRet)
				status = self.lastRet
				if self.progress.value() != status:
					self.progress.setValue(status)
예제 #8
0
    def __init__(self):
        self.plugins = {}
        self.brokerages = {}

        # Load all plugins in user plugins path
        prefsRoot = Prefs.prefsRootPath()
        sys.path.append(prefsRoot + "plugins")
        path = os.path.join(prefsRoot, "plugins/plugin_*.py")
        for file in glob.glob(path):
            plugin = file.replace(prefsRoot + "plugins", "")
            plugin = plugin.replace("/", "")
            plugin = plugin.replace("\\", "")
            plugin = plugin.replace(".py", "")
            __import__(plugin)
            self.plugins[plugin] = sys.modules[plugin].Plugin()
            self.plugins[plugin].builtin = False

            # Load all plugins in builtin path
        pluginPath = os.path.join(appGlobal.getPath(), "builtinPlugins")
        sys.path.append(pluginPath)
        for file in glob.glob(pluginPath + "/plugin_*.py"):
            plugin = os.path.basename(file)
            plugin = plugin.replace("/", "")
            plugin = plugin.replace("\\", "")
            plugin = plugin.replace(".py", "")
            __import__(plugin)
            self.plugins[plugin] = sys.modules[plugin].Plugin()
            self.plugins[plugin].builtin = True

            # Check for duplicate names
        names = {}
        for p, plugin in self.plugins.items():
            if plugin.name() in names:
                print "Duplicate plugin name", plugin.name()
                sys.exit()
            names[plugin.name()] = True

        for p, plugin in self.plugins.items():
            plugin.initialize()

            # Check for duplicate names
        names = {}
        for p, plugin in self.plugins.items():
            if plugin.name() in names:
                print "Duplicate plugin name", plugin.name()
                sys.exit()
            names[plugin.name()] = True

            # Load all brokerages in user plugins path
        path = os.path.join(prefsRoot, "plugins/brokerage_*.py")
        for file in glob.glob(path):
            brokerage = file.replace(prefsRoot + "plugins", "")
            brokerage = brokerage.replace("/", "")
            brokerage = brokerage.replace("\\", "")
            brokerage = brokerage.replace(".py", "")
            __import__(brokerage)
            self.brokerages[brokerage] = sys.modules[brokerage].Brokerage()
            self.brokerages[brokerage].builtin = False

            # Load all brokerages in builtin path
        for file in glob.glob("builtinPlugins/brokerage_*.py"):
            brokerage = file.replace("builtinPlugins", "")
            brokerage = brokerage.replace("/", "")
            brokerage = brokerage.replace("\\", "")
            brokerage = brokerage.replace(".py", "")
            __import__(brokerage)
            self.brokerages[brokerage] = sys.modules[brokerage].Brokerage()
            self.brokerages[brokerage].builtin = True

            # Check for duplicate names
        names = {}
        for b, brokerage in self.brokerages.items():
            if brokerage.getName() in names:
                print "Duplicate brokerage name", brokerage.getName()
                sys.exit()
            names[brokerage.getName()] = True