ScolaSync: Fichier source de src/scolasync.py

ScolaSync 5.1 |

scolasync.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python3
2 # $Id: scolasync.py 47 2011-06-13 10:20:14Z georgesk $
3
4
9
10
82
83 licence={}
84 licenceEn="""
85 scolasync version %s:
86
87 a program to manage file transfers between a computer and a collection
88 of USB sticks.
89
90 Copyright (C) 2010-2012 Georges Khaznadar <georgesk@ofset.org>
91
92 This program is free software: you can redistribute it and/or modify
93 it under the terms of the GNU General Public License as published by
94 the Free Software Foundation, either version 3 of the License, or
95 (at your option) any later version.
96
97 This program is distributed in the hope that it will be useful,
98 but WITHOUT ANY WARRANTY; without even the implied warranty of
99 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
100 GNU General Public License for more details.
101
102 You should have received a copy of the GNU General Public License
103 along with this program. If not, see <http://www.gnu.org/licenses/>.
104 """
105 licence['en']=licenceEn
106
107 licenceFr="""
108 scolasync version %s :
109
110 un programme pour gérer des transferts de fichiers entre un
111 ordinateur et une collection de clés USB.
112
113 Copyright (C) 2010-2012 Georges Khaznadar <georgesk@ofset.org>
114
115 Ce projet est un logiciel libre : vous pouvez le redistribuer, le
116 modifier selon les terme de la GPL (GNU Public License) dans les
117 termes de la Free Software Foundation concernant la version 3 ou
118 plus de la dite licence.
119
120 Ce programme est fait avec l'espoir qu'il sera utile mais SANS
121 AUCUNE GARANTIE. Lisez la licence pour plus de détails.
122
123 <http://www.gnu.org/licenses/>.
124 """
125 licence['fr']=licenceFr
126
127
128 import getopt, os, sys
129
130 import sip
131 # pour éviter des erreurs à l'instanciation des QVariant
132 sip.setapi('QVariant', 1)
133
134 import debug
135
136 from PyQt5.QtCore import *
137 from PyQt5.QtWidgets import *
138
139
144
145 def run(debugger=False, callback=lambda x: print(x)):
146
147 from dbus.mainloop.pyqt5 import DBusQtMainLoop
148 DBusQtMainLoop(set_as_default=True)
149
150 app = QApplication(sys.argv)
151
152 locale = "%s" %QLocale.system().name()
153 qtTranslator = QTranslator()
154 if qtTranslator.load("qt_" + locale, "/usr/share/qt5/translations"):
155 # print "OK for qttranslator"
156 app.installTranslator(qtTranslator)
157 appTranslator = QTranslator()
158 for path in ["/usr/share/scolasync","."]:
159 langdir=os.path.join(path,"lang",locale+".qm")
160 b= appTranslator.load(langdir)
161 if b:
162 # print "installation du fichier de traduction", langdir
163 app.installTranslator(appTranslator)
164 break
165
166 import mainWindow
167 window = mainWindow.mainWindow(None,locale)
168 if debugger:
169 debug.button(window, callback)
170 window.show()
171
172 sys.exit(app.exec_())
173
174 if __name__ == '__main__':
175 # run(debugger=True, callback=debug.listePartitionsCochees)
176 run()
src.scolasync.run
def run(debugger=False, callback=lambda x:print(x))
Le lancement de l'application.
Definition: scolasync.py:145
QtCore
QtWidgets
src.mainWindow.mainWindow
defines the main window of the application.
Definition: mainWindow.py:64