4
# Copyright 2011-2012 Dmitry Shachnev
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23
from ReText.window import ReTextWindow
26
app = QApplication(sys.argv)
27
app.setOrganizationName("ReText project")
28
app.setApplicationName("ReText")
29
RtTranslator = QTranslator()
31
if RtTranslator.load('retext_'+QLocale.system().name(), path+'/locale'):
33
QtTranslator = QTranslator()
34
QtTranslator.load("qt_"+QLocale.system().name(), QLibraryInfo.location(QLibraryInfo.TranslationsPath))
35
app.installTranslator(RtTranslator)
36
app.installTranslator(QtTranslator)
37
if settings.contains('appStyleSheet'):
38
stylename = readFromSettings('appStyleSheet', str)
39
sheetfile = QFile(stylename)
40
sheetfile.open(QIODevice.ReadOnly)
41
app.setStyleSheet(QTextStream(sheetfile).readAll())
43
window = ReTextWindow()
45
fileNames = [QFileInfo(arg).canonicalFilePath() for arg in sys.argv[1:]]
46
for fileName in fileNames:
48
fileName = QString.fromUtf8(fileName)
50
# Not needed for Python 3
52
if QFile.exists(fileName):
53
window.openFileWrapper(fileName)
56
if __name__ == '__main__':