Debian Codegraph @

src/EdViewTest.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 if __name__ == '__main__':
4 import sys, os, optparse
5
6 usage = "usage: %prog filename"
7 op = optparse.OptionParser(usage=usage)
8 (options, args) = op.parse_args()
9
10 if len(args) != 1:
11 print('Please specify a filename', file=sys.stderr)
12 sys.exit(-1)
13 filename = args[0]
14 filename = os.path.abspath(filename)
15 if not os.access(filename, os.R_OK):
16 print('Failed to read the file:', filename)
17 sys.exit(-2)
18
19
20 app_dir = os.path.dirname(os.path.realpath(__file__))
21 os.chdir(app_dir)
22
23 from PyQt6 import QtWidgets, QtGui, QtCore
24 from PyQt6.QtWidgets import *
25 from PyQt6.QtGui import *
26 from PyQt6.QtCore import *
27 from view import EdView, EdViewRW
28 import view
29
30 view.load_plugins()
31
32 app = QApplication(sys.argv)
33
34 w = QMainWindow()
35 if os.getenv("SEASCOPE_EDIT", 0):
36 book = EdViewRW.EditorBookRW()
37 else:
38 book = EdView.EditorBook()
39
40 actDescr = [
41 [ book.find_cb, 'Ctrl+F' ],
42 [ book.find_next_cb, 'F3' ],
43 [ book.find_prev_cb, 'Shift+F3' ],
44 ]
45 for ad in actDescr:
46 act = QAction(w)
47 act.setShortcut(ad[1])
48 act.triggered.connect(ad[0])
49 w.addAction(act)
50
51 w.setCentralWidget(book)
52 w.resize(900, 600)
53 w.show()
54
55 book.show_file(filename)
56 w.setWindowTitle(filename)
57
58 sys.exit(app.exec())