Exemple #1
0
    def __init__(self,parent,config):
        super(Newsfeed,self).__init__(parent)
        self.locale = config["locale"]
        QLocale.setDefault(self.locale)
        self.config = config
        self.all_head_lines = []
        self.timerFeed = QtCore.QTimer(self)
        self.timerNews = QtCore.QTimer(self)
        self.date_pub = QtWidgets.QLabel()
        self.title_pub = QtWidgets.QLabel()
        self.date_pub.setObjectName("datePub")
        self.title_pub.setObjectName("titlePub")
        self.layout = QtWidgets.QGridLayout(self)
        self.layout.addWidget(self.date_pub)
        self.layout.addWidget(self.title_pub)
        self.layout.setAlignment(Ressources.getAlignment("bottom_left"))
        self.setStyleSheet("""
                           #datePub,#titlePub {
                               color:white; 
                               padding: 6px;
                            } 
                            #titlePub {
                               font: bold 35px;
                            } 
                            #datePub {
                               font: 25px;
                            } 
                            """)



        self.connect(self.timerFeed,QtCore.SIGNAL('timeout()'),self.getNewsFedd)
        self.timerFeed.start(6*60*60*1000)
        self.getNewsFedd()      
Exemple #2
0
    def __init__(self, parent, config):
        super(Clock, self).__init__(parent)
        self.locale = config["locale"]

        QLocale.setDefault(self.locale)
        self.curTime = QtWidgets.QLabel()
        self.curTime.setObjectName("curTime")
        curDate = QtWidgets.QLabel(QLocale().toString(
            QtCore.QDate.currentDate()).capitalize())
        curDate.setObjectName("curdate")
        self.layout = QtWidgets.QGridLayout(self)
        self.layout.addWidget(curDate)
        self.layout.addWidget(self.curTime)
        self.layout.setAlignment(Ressources.getAlignment(config["alignment"]))
        self.setStyleSheet("""
                           #curdate,#curTime {
                               color:white; 
                               font: bold 35px;
                               padding: 6px;
                            } 
                            """)
        self.curTime.setAlignment(Ressources.getAlignment("center"))
        timer = QtCore.QTimer(self)
        self.connect(timer, QtCore.SIGNAL('timeout()'), self.showTime)
        timer.start(1000)
        self.showTime()
Exemple #3
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     QLocale.setDefault(QLocale.English)
     self.__central_widget = None
     self.__menu_bar = None
     self.__status_bar = None
     self.__g_code_sender = GCodeSender()
     self.__init_central_widget()
     # self.__init_menu_bar_widget()
     layout = QVBoxLayout(self)
     layout.addWidget(self.__central_widget)
Exemple #4
0
 def __init__(self, parent=None):
     QLocale.setDefault(QLocale.English)
     QMainWindow.__init__(self, parent)
     self.setWindowTitle("AMLab Software v1.0")
     self.supported_printers = ['DLP', 'Metal']
     self.selected_printer = self.supported_printers[0]
     self.__init_setup__()
     self.dlp_gui = None
     self.metal_gui = None
     # self.dlp_gui.hide()
     # self.metal_gui.hide()
     self.setup_widget.hide()
     self.__init_menu_bar__()
     if not self.__load_settings__():
         self.__select_setup_widget__()
Exemple #5
0
def startNexT(cfgfile, active, execScripts, execCode, withGui):
    """
    Starts next with the given config file and activates the given application.
    :param cfgfile: path to config file
    :param active: active application (if None, the first application in the config will be used)
    :return: None
    """
    logger.debug("Starting nexxT...")
    config = Configuration()
    lcl = QLocale.system()
    lcl.setNumberOptions(QLocale.c().numberOptions())
    QLocale.setDefault(lcl)
    if withGui:
        app = QApplication() if QApplication.instance() is None else QApplication.instance()
        app.setWindowIcon(QIcon(":icons/nexxT.svg"))
        app.setOrganizationName("nexxT")
        app.setApplicationName("nexxT")
        setupGuiServices(config)
    else:
        app = QCoreApplication() if QCoreApplication.instance() is None else QCoreApplication.instance()
        app.setOrganizationName("nexxT")
        app.setApplicationName("nexxT")
        setupConsoleServices(config)

    if cfgfile is not None:
        ConfigFileLoader.load(config, cfgfile)
    if withGui:
        mainWindow = Services.getService("MainWindow")
        mainWindow.restoreState()
        mainWindow.show()
        # the reference will still be held by the service, but here we don't need it anymore
        del mainWindow
    if active is not None:
        config.activate(active)
        # pylint: disable=unused-variable
        # need to hold the reference of this until the method is called
        i2 = MethodInvoker(dict(object=Application, method="initialize", thread=app.thread()),
                           MethodInvoker.IDLE_TASK) # pylint: disable=unused-variable
        waitForSignal(config.appActivated)
        if Application.activeApplication.getState() != FilterState.ACTIVE:
            waitForSignal(Application.activeApplication.stateChanged, lambda s: s == FilterState.ACTIVE)
        logger.info("done")

    def cleanup():
        logger.debug("cleaning up loaded services")
        Services.removeAll()
        logger.debug("cleaning up loaded plugins")
        for v in ("last_traceback", "last_type", "last_value"):
            if hasattr(sys, v):
                del sys.__dict__[v]
        #PluginManager.singleton().unloadAll()
        logger.debug("cleaning up complete")

    code_globals = {}
    for c in execCode:
        logger.info("Executing code '%s'", c)
        # note that exec is used intentionally here to provide the user with scripting posibilities
        exec(compile(c, "<string>", 'exec'), code_globals) # pylint: disable=exec-used
        logger.debug("Executing code done")

    for s in execScripts:
        logger.info("Executing script '%s'", s)
        with open(s) as fscript:
            # note that exec is used intentionally here to provide the user with scripting possibilities
            exec(compile(fscript.read(), s, 'exec'), code_globals)  # pylint: disable=exec-used
        logger.debug("Executing script done")

    res = app.exec_()
    logger.debug("closing config")
    config.close()
    cleanup()

    logger.internal("app.exec_ returned")

    return res
Exemple #6
0
    except ÖtvFormatException as ö:
        for e in ö.errors:
            print(e)


if __name__ == "__main__":

    # deal with resources early:
    fontPath = resources.path("NotoSansDisplay-Regular.ttf")
    iconPath = resources.path("icon.svg")

    styleSheet = resources.load(
        "stylesheet.vars.css",
        lambda f: "\n".join(varredCss2Css(f.readlines())))

    settings = AbakusSettings()
    rechner = Summierer(getÖtv())

    QLocale.setDefault(QLocale(QLocale.German, QLocale.Germany))
    app = qw.QApplication([])
    QFontDatabase().addApplicationFont(fontPath)

    app.setStyleSheet(styleSheet)
    app.setWindowIcon(QIcon(iconPath))
    checkLicenseAgreement(settings)

    widget = Abakus(settings, rechner)
    widget.show()

    sys.exit(app.exec_())