~ubuntu-branches/ubuntu/saucy/retext/saucy

« back to all changes in this revision

Viewing changes to .pc/git_fix_monospace_fonts.patch/retext.py

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2013-05-22 12:42:58 UTC
  • mfrom: (17.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130522124258-jci3mcoxtc1ruwf5
Tags: 4.0.1-2
* debian/rules: use lrelease-qt4 instead of lrelease.
* Build qm files directly in locale, and add locale/*qm to
  extend-diff-ignore.
* Added Brazilian Portuguese translation (from Transifex).
* Drop the reStructuredText mime file, instead recommend
  docutils-common (>= 0.10-3~) which ships it now.
* debian/patches/git_fix_monospace_fonts.patch: work-around
  monospace fonts not working with QtWebKit 2.3 (LP: #1165378).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
 
 
3
# ReText
 
4
# Copyright 2011-2012 Dmitry Shachnev
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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,
 
19
# MA 02110-1301, USA.
 
20
 
 
21
import sys
 
22
from ReText import *
 
23
from ReText.window import ReTextWindow
 
24
 
 
25
def main():
 
26
        app = QApplication(sys.argv)
 
27
        app.setOrganizationName("ReText project")
 
28
        app.setApplicationName("ReText")
 
29
        RtTranslator = QTranslator()
 
30
        for path in datadirs:
 
31
                if RtTranslator.load('retext_'+QLocale.system().name(), path+'/locale'):
 
32
                        break
 
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())
 
42
                sheetfile.close()
 
43
        window = ReTextWindow()
 
44
        window.show()
 
45
        fileNames = [QFileInfo(arg).canonicalFilePath() for arg in sys.argv[1:]]
 
46
        for fileName in fileNames:
 
47
                try:
 
48
                        fileName = QString.fromUtf8(fileName)
 
49
                except:
 
50
                        # Not needed for Python 3
 
51
                        pass
 
52
                if QFile.exists(fileName):
 
53
                        window.openFileWrapper(fileName)
 
54
        sys.exit(app.exec_())
 
55
 
 
56
if __name__ == '__main__':
 
57
        main()