1 | #The Flight Info tab
|
---|
2 |
|
---|
3 | from common import *
|
---|
4 |
|
---|
5 | class FlightInfo(gtk.VBox):
|
---|
6 | """The flight info tab."""
|
---|
7 | @staticmethod
|
---|
8 | def _createCommentArea(label):
|
---|
9 | """Create a comment area.
|
---|
10 |
|
---|
11 | Returns a tuple of two items:
|
---|
12 | - the top-level widget of the comment area, and
|
---|
13 | - the comment text editor."""
|
---|
14 |
|
---|
15 | frame = gtk.Frame(label = label)
|
---|
16 | label = frame.get_label_widget()
|
---|
17 | label.set_use_underline(True)
|
---|
18 |
|
---|
19 | alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
|
---|
20 | xscale = 1.0, yscale = 1.0)
|
---|
21 | alignment.set_padding(padding_top = 4, padding_bottom = 4,
|
---|
22 | padding_left = 8, padding_right = 8)
|
---|
23 |
|
---|
24 | scroller = gtk.ScrolledWindow()
|
---|
25 | scroller.set_policy(gtk.PolicyType.AUTOMATIC if pygobject
|
---|
26 | else gtk.POLICY_AUTOMATIC,
|
---|
27 | gtk.PolicyType.AUTOMATIC if pygobject
|
---|
28 | else gtk.POLICY_AUTOMATIC)
|
---|
29 | scroller.set_shadow_type(gtk.ShadowType.IN if pygobject
|
---|
30 | else gtk.SHADOW_IN)
|
---|
31 | comments = gtk.TextView()
|
---|
32 | scroller.add(comments)
|
---|
33 | alignment.add(scroller)
|
---|
34 | frame.add(alignment)
|
---|
35 |
|
---|
36 | label.set_mnemonic_widget(comments)
|
---|
37 |
|
---|
38 | return (frame, comments)
|
---|
39 |
|
---|
40 | def __init__(self, gui):
|
---|
41 | """Construct the flight info tab."""
|
---|
42 | super(FlightInfo, self).__init__()
|
---|
43 | self._gui = gui
|
---|
44 |
|
---|
45 | commentsBox = gtk.HBox()
|
---|
46 |
|
---|
47 | (frame, self._comments) = FlightInfo._createCommentArea("_Comments")
|
---|
48 | commentsBox.pack_start(frame, True, True, 8)
|
---|
49 |
|
---|
50 | (frame, self._flightDefects) = FlightInfo._createCommentArea("Flight _defects")
|
---|
51 | commentsBox.pack_start(frame, True, True, 8)
|
---|
52 |
|
---|
53 | self.pack_start(commentsBox, True, True, 8)
|
---|
54 |
|
---|
55 | frame = gtk.Frame(label = "Delay codes")
|
---|
56 | label = frame.get_label_widget()
|
---|
57 | label.set_use_underline(True)
|
---|
58 |
|
---|
59 | alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
|
---|
60 | xscale = 0.0, yscale = 0.0)
|
---|
61 | alignment.set_padding(padding_top = 4, padding_bottom = 4,
|
---|
62 | padding_left = 8, padding_right = 8)
|
---|
63 |
|
---|
64 | table = gtk.Table(5, 2)
|
---|
65 | table.set_col_spacings(16)
|
---|
66 |
|
---|
67 | self._loadingProblems = gtk.CheckButton("L_oading problems")
|
---|
68 | self._loadingProblems.set_use_underline(True)
|
---|
69 | table.attach(self._loadingProblems, 0, 1, 0, 1)
|
---|
70 |
|
---|
71 | self._vatsimProblem = gtk.CheckButton("_VATSIM problem")
|
---|
72 | self._vatsimProblem.set_use_underline(True)
|
---|
73 | table.attach(self._vatsimProblem, 1, 2, 0, 1)
|
---|
74 |
|
---|
75 | self._netProblems = gtk.CheckButton("_Net problems")
|
---|
76 | self._netProblems.set_use_underline(True)
|
---|
77 | table.attach(self._netProblems, 0, 1, 1, 2)
|
---|
78 |
|
---|
79 | self._controllersFault = gtk.CheckButton("Controllers _fault")
|
---|
80 | self._controllersFault.set_use_underline(True)
|
---|
81 | table.attach(self._controllersFault, 1, 2, 1, 2)
|
---|
82 |
|
---|
83 | self._systemCrash = gtk.CheckButton("S_ystem crash/freeze")
|
---|
84 | self._systemCrash.set_use_underline(True)
|
---|
85 | table.attach(self._systemCrash, 0, 1, 2, 3)
|
---|
86 |
|
---|
87 | self._navigationProblem = gtk.CheckButton("Navi_gation problem")
|
---|
88 | self._navigationProblem.set_use_underline(True)
|
---|
89 | table.attach(self._navigationProblem, 1, 2, 2, 3)
|
---|
90 |
|
---|
91 | self._trafficProblems = gtk.CheckButton("T_raffic problems")
|
---|
92 | self._trafficProblems.set_use_underline(True)
|
---|
93 | table.attach(self._trafficProblems, 0, 1, 3, 4)
|
---|
94 |
|
---|
95 | self._apronProblem = gtk.CheckButton("_Apron navigation problem")
|
---|
96 | self._apronProblem.set_use_underline(True)
|
---|
97 | table.attach(self._apronProblem, 1, 2, 3, 4)
|
---|
98 |
|
---|
99 | self._weatherProblems = gtk.CheckButton("_Weather problems")
|
---|
100 | self._weatherProblems.set_use_underline(True)
|
---|
101 | table.attach(self._weatherProblems, 0, 1, 4, 5)
|
---|
102 |
|
---|
103 | self._personalReasons = gtk.CheckButton("_Personal reasons")
|
---|
104 | self._personalReasons.set_use_underline(True)
|
---|
105 | table.attach(self._personalReasons, 1, 2, 4, 5)
|
---|
106 |
|
---|
107 | alignment.add(table)
|
---|
108 | frame.add(alignment)
|
---|
109 |
|
---|
110 | alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
|
---|
111 | xscale = 0.0, yscale = 0.0)
|
---|
112 | alignment.add(frame)
|
---|
113 |
|
---|
114 | self.pack_start(alignment, False, False, 8)
|
---|
115 |
|
---|
116 | def reset(self):
|
---|
117 | """Reset the flight info tab."""
|
---|
118 | self._comments.get_buffer().set_text("")
|
---|
119 | self._flightDefects.get_buffer().set_text("")
|
---|
120 |
|
---|
121 | self._loadingProblems.set_active(False)
|
---|
122 | self._vatsimProblem.set_active(False)
|
---|
123 | self._netProblems.set_active(False)
|
---|
124 | self._controllersFault.set_active(False)
|
---|
125 | self._systemCrash.set_active(False)
|
---|
126 | self._navigationProblem.set_active(False)
|
---|
127 | self._trafficProblems.set_active(False)
|
---|
128 | self._apronProblem.set_active(False)
|
---|
129 | self._weatherProblems.set_active(False)
|
---|
130 | self._personalReasons.set_active(False)
|
---|
131 |
|
---|