Beispiel #1
0
	def quit (self):
		self.loginTimer.stop()
		self.quotaTimer.stop()
		settings= QSettings ("DA-IICT", "SAM")
		settings.setValue ("size", self.size())
		settings.setValue ("pos", self.pos())
		os.remove(lck_file)
		qApp.quit()
Beispiel #2
0
	def saveAccounts (self):
		settings = QSettings('DA-IICT', 'SAM')
		settings.beginGroup("Accounts")
		settings.setValue("Length", self.table.topLevelItemCount())
		for i in range(self.table.topLevelItemCount()):
			ac = self.table.topLevelItem(i)
			temp = str(ac.text(0))+'!@#$%'+ b64encode(str(ac.passwd))
			temp1 = "Account"+str(i)
			settings.setValue(temp1, temp)
		settings.endGroup()
Beispiel #3
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    app.setOrganizationName('meteo-qt')
    app.setOrganizationDomain('meteo-qt')
    app.setApplicationName('meteo-qt')
    app.setWindowIcon(QIcon(':/logo'))
    filePath = os.path.dirname(os.path.realpath(__file__))
    settings = QSettings()
    locale = settings.value('Language')
    if locale is None or locale == '':
        locale = QLocale.system().name()
    appTranslator = QTranslator()
    if os.path.exists(filePath + '/translations/'):
        appTranslator.load(filePath + "/translations/meteo-qt_" + locale)
    else:
        appTranslator.load("/usr/share/meteo_qt/translations/meteo-qt_" +
                           locale)
    app.installTranslator(appTranslator)
    qtTranslator = QTranslator()
    qtTranslator.load("qt_" + locale,
                      QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    log_level = settings.value('Logging/Level')
    if log_level == '' or log_level is None:
        log_level = 'INFO'
        settings.setValue('Logging/Level', 'INFO')

    log_filename = os.path.dirname(settings.fileName())
    if not os.path.exists(log_filename):
        os.makedirs(log_filename)
    log_filename = log_filename + '/meteo-qt.log'

    logging.basicConfig(
        format='%(asctime)s %(levelname)s: %(message)s - %(module)s - %(name)s',
        datefmt='%m/%d/%Y %H:%M:%S',
        filename=log_filename,
        level=log_level)
    logger = logging.getLogger('meteo-qt')
    logger.setLevel(log_level)
    handler = logging.handlers.RotatingFileHandler(log_filename,
                                                   maxBytes=20,
                                                   backupCount=5)
    logger1 = logging.getLogger()
    handler1 = logging.StreamHandler()
    logger1Formatter = logging.Formatter(
        '%(levelname)s: %(message)s - %(module)s')
    handler1.setFormatter(logger1Formatter)
    logger.addHandler(handler)
    logger1.addHandler(handler1)

    m = SystemTrayIcon()
    app.exec_()
Beispiel #4
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    app.setOrganizationName('meteo-qt')
    app.setOrganizationDomain('meteo-qt')
    app.setApplicationName('meteo-qt')
    app.setWindowIcon(QIcon(':/logo'))
    filePath = os.path.dirname(os.path.realpath(__file__))
    settings = QSettings()
    locale = settings.value('Language')
    if locale is None or locale == '':
        locale = QLocale.system().name()
    appTranslator = QTranslator()
    if os.path.exists(filePath + '/translations/'):
        appTranslator.load(filePath + "/translations/meteo-qt_" + locale)
    else:
        appTranslator.load("/usr/share/meteo_qt/translations/meteo-qt_" +
                           locale)
    app.installTranslator(appTranslator)
    qtTranslator = QTranslator()
    qtTranslator.load("qt_" + locale,
                      QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    log_level = settings.value('Logging/Level')
    if log_level == '' or log_level is None:
        log_level = 'INFO'
        settings.setValue('Logging/Level', 'INFO')

    log_filename = os.path.dirname(settings.fileName())
    if not os.path.exists(log_filename):
        os.makedirs(log_filename)
    log_filename = log_filename + '/meteo-qt.log'

    logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s - %(module)s - %(name)s',
                        datefmt='%m/%d/%Y %H:%M:%S',
                        filename=log_filename, level=log_level)
    logger = logging.getLogger('meteo-qt')
    logger.setLevel(log_level)
    handler = logging.handlers.RotatingFileHandler(
        log_filename, maxBytes=20, backupCount=5)
    logger1 = logging.getLogger()
    handler1 = logging.StreamHandler()
    logger1Formatter = logging.Formatter('%(levelname)s: %(message)s - %(module)s')
    handler1.setFormatter(logger1Formatter)
    logger.addHandler(handler)
    logger1.addHandler(handler1)

    m = SystemTrayIcon()
    app.exec_()
Beispiel #5
0
def newToken(code):
    import requests
    import settings

    client_id = settings.getClientID()
    client_secret = settings.getClientSecret()

    url = 'https://slack.com/api/oauth.access'

    payload = {'client_id': client_id, 'client_secret': client_secret, 'code': code}
    r = requests.post(url, params=payload)

    token_start = r.text.find('xox')

    token = r.text[token_start:(token_start + 51)]

    settings.setValue('tokens', 'owner_token', token)
Beispiel #6
0
 def saveLayout(self):
     """
     Save the layout of each widget
     """
     settings=self.settings
     settings.setValue("geometry", self.saveGeometry())
     settings.setValue("windowState", self.saveState())
     settings.setValue("fontSize", app.font().pointSize())
Beispiel #7
0
 def saveLayout(self):
     """
     Save the layout of each widget
     """
     settings = self.settings
     settings.setValue("geometry", self.saveGeometry())
     settings.setValue("windowState", self.saveState())
     settings.setValue("fontSize", app.font().pointSize())
Beispiel #8
0
    def closeEvent(self, event):
        settings = QSettings()
        settings.setValue("geometry", self.saveGeometry())
        settings.setValue("windowState", self.saveState())
        for widget in self.note_views.values():
            table_name = widget.view.__class__.__name__+"State"
            settings.setValue(table_name, widget.view.horizontalHeader().saveState())

        QMainWindow.closeEvent(self, event)
Beispiel #9
0
 def setConfig(cls, key, value):
     """ set config """
     settings = QtCore.QSettings("myFlickr", "mySync")
     settings.setValue(key, value)
Beispiel #10
0
 def setConfig(cls, key, value):
     """ set config """
     settings = QtCore.QSettings("myFlickr", "mySync")
     settings.setValue(key, value)
Beispiel #11
0
		import settings 
		settings.ns.show()

	def quit(self):
		print u"Quit"
		sys.exit()

if __name__ == "__main__":
	app = QApplication(sys.argv)
	
	if(QSystemTrayIcon.isSystemTrayAvailable() != 1 ):
		message = QMessageBox(self)
		message.setText(u'Could not detect system tray')
		message.setIcon(QMessageBox.Warning)
		message.addButton("Quit", QMessageBox.RejectRole)
		message.exec_()
		response = message.clickedButton().text()
		
		if response == "Quit":
			sys.exit()

	else:
		print u"YaNMa starting..."
		settings = QSettings()
		settings.setValue("popupmessages", QVariant(QSystemTrayIcon.supportsMessages()));
	
		app.setQuitOnLastWindowClosed(0)
		myob = TrayBase()
			
	sys.exit(app.exec_())