Merge lp:~costales/gui-ufw/renamed_object into lp:gui-ufw

Proposed by costales on 2019-05-11
Status: Merged
Merged at revision: 30
Proposed branch: lp:~costales/gui-ufw/renamed_object
Merge into: lp:gui-ufw
Prerequisite: lp:~costales/gui-ufw/force_fw_status
Diff against target: 668 lines (+121/-121)
5 files modified
gufw/gufw/view/add.py (+19/-19)
gufw/gufw/view/gufw.py (+70/-70)
gufw/gufw/view/listening.py (+4/-4)
gufw/gufw/view/preferences.py (+19/-19)
gufw/gufw/view/update.py (+9/-9)
To merge this branch: bzr merge lp:~costales/gui-ufw/renamed_object
Reviewer Review Type Date Requested Status
costales Pending
Review via email: mp+367307@code.launchpad.net

Description of the change

Not force FW status and rename object

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gufw/gufw/view/add.py'
2--- gufw/gufw/view/add.py 2019-05-01 08:45:59 +0000
3+++ gufw/gufw/view/add.py 2019-05-11 17:52:09 +0000
4@@ -100,7 +100,7 @@
5 self.advanced_iface.append_text(_("All Interfaces"))
6 # Translators: About traffic
7 self.advanced_routed.append_text(_("Not Forward"))
8- for ifaceName in self.gufw.fw.get_net_interfaces():
9+ for ifaceName in self.gufw.frontend.get_net_interfaces():
10 self.advanced_iface.append_text(ifaceName)
11 self.advanced_routed.append_text(ifaceName)
12 self.advanced_iface.set_active(0)
13@@ -108,7 +108,7 @@
14 self.advanced_log.set_active(0)
15 self.advanced_protocol.set_active(0)
16
17- if self.gufw.fw.get_policy('routed') == 'disabled':
18+ if self.gufw.frontend.get_policy('routed') == 'disabled':
19 self.advanced_routed_img.set_visible(False)
20 self.advanced_routed.set_visible(False)
21
22@@ -164,16 +164,16 @@
23 return True # Overwrite event
24
25 def _win_close(self):
26- self.gufw.show_add_btn.set_sensitive(self.gufw.fw.get_status())
27- self.gufw.edit_rule_btn.set_sensitive(self.gufw.fw.get_status())
28- self.gufw.report_rule_btn.set_sensitive(self.gufw.fw.get_status())
29+ self.gufw.show_add_btn.set_sensitive(self.gufw.frontend.get_status())
30+ self.gufw.edit_rule_btn.set_sensitive(self.gufw.frontend.get_status())
31+ self.gufw.report_rule_btn.set_sensitive(self.gufw.frontend.get_status())
32 self._hide_win()
33
34 def on_copy_from_IP_clicked(self, widget, data=None):
35- self.advanced_from_ip.set_text(self.gufw.fw.get_internal_ip())
36+ self.advanced_from_ip.set_text(self.gufw.frontend.get_internal_ip())
37
38 def on_copy_to_IP_clicked(self, widget, data=None):
39- self.advanced_to_ip.set_text(self.gufw.fw.get_internal_ip())
40+ self.advanced_to_ip.set_text(self.gufw.frontend.get_internal_ip())
41
42 def on_copy_simple_to_advanced_clicked(self, widget, data=None):
43 self.advanced_rule_name.set_text(self.simple_rule_name.get_text())
44@@ -359,11 +359,11 @@
45 self.advanced_routed.set_tooltip_text(_("You need to set an Interface for forwarding to this another interface"))
46
47 # Not allow same iface when is routed
48- if self.gufw.fw.get_policy('routed') != 'disabled':
49+ if self.gufw.frontend.get_policy('routed') != 'disabled':
50 self.advanced_routed.remove_all()
51 # Translators: About traffic
52 self.advanced_routed.append_text(_("Not Forward"))
53- for ifaceName in self.gufw.fw.get_net_interfaces(self.advanced_iface.get_active_text()):
54+ for ifaceName in self.gufw.frontend.get_net_interfaces(self.advanced_iface.get_active_text()):
55 self.advanced_routed.append_text(ifaceName)
56 self.advanced_routed.set_active(0)
57
58@@ -378,7 +378,7 @@
59 self.warningbox.hide()
60
61 def on_btnAddRuleWin_clicked(self, widget, data=None):
62- if not self.gufw.fw.get_status():
63+ if not self.gufw.frontend.get_status():
64 self.gufw.show_dialog(self.win_add, _("Error: Firewall is disabled"), _("The firewall has to be enabled first"))
65 return
66
67@@ -399,10 +399,10 @@
68 from_port = from_split
69 to_port = to_split
70 if direction == 'both':
71- cmd = self.gufw.fw.add_rule(name, insert, policy, 'in', iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
72- cmd = self.gufw.fw.add_rule(name, insert, policy, 'out', iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
73+ cmd = self.gufw.frontend.add_rule(name, insert, policy, 'in', iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
74+ cmd = self.gufw.frontend.add_rule(name, insert, policy, 'out', iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
75 else:
76- cmd = self.gufw.fw.add_rule(name, insert, policy, direction, iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
77+ cmd = self.gufw.frontend.add_rule(name, insert, policy, direction, iface, routed, logging, proto, from_ip, from_port, to_ip, to_port)
78
79 if cmd[0]:
80 flag_Warning = True
81@@ -422,7 +422,7 @@
82 self.gufw.set_statusbar_msg(_("Error: No rules added. Review the log"))
83
84 def _add_rule_preconfig(self):
85- self._add(self.gufw.fw.get_profile(), # profile
86+ self._add(self.gufw.frontend.get_profile(), # profile
87 self.preconfig_app.get_active_text(), # name
88 self.gufw.NUM2POLICY[self.preconfig_policy.get_active()], # policy
89 self.gufw.NUM2DIRECTION[self.preconfig_direction.get_active()], # direction
90@@ -431,7 +431,7 @@
91 '', # from port
92 '', # to IP
93 self.apps.get_app(self.preconfig_app.get_active_text())[1]) # to port[/proto][|port[/proto]]
94- self.gufw.print_rules(self.gufw.fw.get_rules())
95+ self.gufw.print_rules(self.gufw.frontend.get_rules())
96
97 def _add_rule_simple(self):
98 if not self.simple_port.get_text():
99@@ -442,7 +442,7 @@
100 self.gufw.show_dialog(self.win_add, _("Edward Snowden's Greatest Fear"), _('"Nothing Will Change"'))
101 return
102
103- self._add(self.gufw.fw.get_profile(), # profile
104+ self._add(self.gufw.frontend.get_profile(), # profile
105 self.simple_rule_name.get_text(), # name
106 self.gufw.NUM2POLICY[self.simple_policy.get_active()], # policy
107 self.gufw.NUM2DIRECTION[self.simple_direction.get_active()], # direction
108@@ -451,7 +451,7 @@
109 '', # from port
110 '', # to IP
111 self.simple_port.get_text()) # to port
112- self.gufw.print_rules(self.gufw.fw.get_rules())
113+ self.gufw.print_rules(self.gufw.frontend.get_rules())
114
115 def _add_rule_advanced(self):
116 # Validations
117@@ -478,7 +478,7 @@
118 to_ip = self.advanced_to_ip.get_text()
119 to_port = self.advanced_to_port.get_text()
120
121- self._add(self.gufw.fw.get_profile(), # profile
122+ self._add(self.gufw.frontend.get_profile(), # profile
123 self.advanced_rule_name.get_text(), # name
124 self.gufw.NUM2POLICY[self.advanced_policy.get_active()], # policy
125 self.gufw.NUM2DIRECTION[self.advanced_direction.get_active()], # direction
126@@ -491,7 +491,7 @@
127 iface, # interface
128 routed, # routed
129 self.gufw.NUM2LOGGING[self.advanced_log.get_active()]) # logging
130- self.gufw.print_rules(self.gufw.fw.get_rules())
131+ self.gufw.print_rules(self.gufw.frontend.get_rules())
132
133
134 class AppProfiles:
135
136=== modified file 'gufw/gufw/view/gufw.py'
137--- gufw/gufw/view/gufw.py 2019-05-11 17:52:08 +0000
138+++ gufw/gufw/view/gufw.py 2019-05-11 17:52:09 +0000
139@@ -70,7 +70,7 @@
140 2: 'log-all'}
141
142 def __init__(self, frontend):
143- self.fw = frontend
144+ self.frontend = frontend
145
146 self.builder = Gtk.Builder()
147 self.builder.set_translation_domain('gufw')
148@@ -214,22 +214,22 @@
149 self.stack_vbox.pack_end(stack, True, True, 0)
150
151 def _set_initial_values(self):
152- for profile in self.fw.get_all_profiles():
153+ for profile in self.frontend.get_all_profiles():
154 self.profile.append_text(profile)
155- self.profile.set_active(self.fw.get_all_profiles().index(self.fw.get_profile()))
156-
157- self.switchStatus.set_active(self.fw.get_status())
158-
159- self.incoming.set_active(self.POLICY2NUM[self.fw.get_policy('incoming')])
160- self.outgoing.set_active(self.POLICY2NUM[self.fw.get_policy('outgoing')])
161- self.routed.set_active(self.POLICY2NUM[self.fw.get_policy('routed')])
162- self.incoming.set_sensitive(self.fw.get_status())
163- self.outgoing.set_sensitive(self.fw.get_status())
164- self.routed.set_sensitive(self.fw.get_status())
165- self.show_add_btn.set_sensitive(self.fw.get_status())
166- self.detele_rule_btn.set_sensitive(self.fw.get_status())
167- self.edit_rule_btn.set_sensitive(self.fw.get_status())
168- self.report_rule_btn.set_sensitive(self.fw.get_status())
169+ self.profile.set_active(self.frontend.get_all_profiles().index(self.frontend.get_profile()))
170+
171+ self.switchStatus.set_active(self.frontend.get_status())
172+
173+ self.incoming.set_active(self.POLICY2NUM[self.frontend.get_policy('incoming')])
174+ self.outgoing.set_active(self.POLICY2NUM[self.frontend.get_policy('outgoing')])
175+ self.routed.set_active(self.POLICY2NUM[self.frontend.get_policy('routed')])
176+ self.incoming.set_sensitive(self.frontend.get_status())
177+ self.outgoing.set_sensitive(self.frontend.get_status())
178+ self.routed.set_sensitive(self.frontend.get_status())
179+ self.show_add_btn.set_sensitive(self.frontend.get_status())
180+ self.detele_rule_btn.set_sensitive(self.frontend.get_status())
181+ self.edit_rule_btn.set_sensitive(self.frontend.get_status())
182+ self.report_rule_btn.set_sensitive(self.frontend.get_status())
183
184 render_txt = Gtk.CellRendererText()
185
186@@ -282,7 +282,7 @@
187
188 self.listening = ListeningReport(self)
189
190- self.add_to_log(self.fw.get_log(), self.GRAY, False)
191+ self.add_to_log(self.frontend.get_log(), self.GRAY, False)
192
193 self._load_tutorial()
194
195@@ -291,11 +291,11 @@
196 self._restore_window_size(self.winMain)
197 self.winMain.show_all()
198
199- if self.fw.get_policy('routed') == 'disabled':
200+ if self.frontend.get_policy('routed') == 'disabled':
201 self.routed_lbl.set_visible(False)
202 self.box_routed.set_visible(False)
203
204- self.print_rules(self.fw.get_rules(False))
205+ self.print_rules(self.frontend.get_rules(False))
206
207 self.btn_report_play.hide()
208
209@@ -372,11 +372,11 @@
210 self.show_dialog(self.winMain, _("Error"), _("Filename has not valid characters. Rename the file\nto only letters, numbers, dashes and underscores"))
211 return
212
213- if profile in self.fw.get_all_profiles():
214+ if profile in self.frontend.get_all_profiles():
215 self.set_statusbar_msg(_("Operation cancelled"))
216 self.show_dialog(self.winMain, _("Profile already exists"), _("Delete it before from the Preferences Window or rename the file (the profile will be the filename)"))
217 else:
218- self.fw.import_profile(import_profile)
219+ self.frontend.import_profile(import_profile)
220 self.profile.append_text(profile)
221 self.add_to_log(_("Profile imported: ") + import_profile)
222 self.set_statusbar_msg(_("Profile imported, now you can choose it in the profiles"))
223@@ -391,7 +391,7 @@
224 if export_profile[-8:] != '.profile':
225 export_profile = export_profile + '.profile'
226
227- self.fw.export_profile(export_profile)
228+ self.frontend.export_profile(export_profile)
229 self.add_to_log(_("Profile exported: ") + export_profile)
230 self.set_statusbar_msg(_("Profile exported"))
231
232@@ -407,10 +407,10 @@
233 Gtk.main_quit()
234
235 def _set_shield(self):
236- if self.fw.get_status():
237- file_shield = os.path.join('/usr/share/gufw/media/shields/', self.fw.get_policy('incoming').lower() + '_' + self.fw.get_policy('outgoing').lower() + '_' + self.fw.get_policy('routed').lower() + '.png')
238+ if self.frontend.get_status():
239+ file_shield = os.path.join('/usr/share/gufw/media/shields/', self.frontend.get_policy('incoming').lower() + '_' + self.frontend.get_policy('outgoing').lower() + '_' + self.frontend.get_policy('routed').lower() + '.png')
240 else:
241- if self.fw.get_policy('routed') == 'disabled':
242+ if self.frontend.get_policy('routed') == 'disabled':
243 file_shield = os.path.join('/usr/share/gufw/media/shields/', 'disabled_disabled_disabled.png')
244 else:
245 file_shield = os.path.join('/usr/share/gufw/media/shields/', 'disabled_disabled_enabled.png')
246@@ -419,20 +419,20 @@
247 def on_menu_reset_activate(self, widget, data=None):
248 answer = self._show_question(self.winMain, _("Reset Firewall"), _("This will remove all rules in the current\nprofile and disable the firewall"), _("Do you want to continue?"))
249 if answer:
250- if self.fw.get_status():
251+ if self.frontend.get_status():
252 self.switchStatus.set_active(False)
253- self.fw.reset()
254+ self.frontend.reset()
255 self.add_to_log(_("Removed rules and reset firewall!"))
256
257 def on_btnLogRemove_clicked(self, widget, data=None):
258- self.fw.refresh_log()
259+ self.frontend.refresh_log()
260 self.log_txt.set_text('')
261 self.add_to_log(_("Gufw Log: Removed"))
262 self.set_statusbar_msg(_("Gufw Log removed"))
263
264 def on_btnLogCopy_clicked(self, widget, data=None):
265 self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
266- self.clipboard.set_text(self.fw.get_log(), -1)
267+ self.clipboard.set_text(self.frontend.get_log(), -1)
268 self.set_statusbar_msg(_("Text copied to clipboard"))
269
270 def on_donate_btn_clicked(self, widget, data=None):
271@@ -472,32 +472,32 @@
272 preferenceswin = Preferences(self)
273
274 def on_incoming_changed(self, widget, data=None):
275- self.fw.set_policy('incoming', self.NUM2POLICY[self.incoming.get_active()].lower())
276+ self.frontend.set_policy('incoming', self.NUM2POLICY[self.incoming.get_active()].lower())
277 self._set_shield()
278 # Translators: Policy
279- self.add_to_log(_("Incoming: ") + self.incoming.get_active_text(), self.POLICY2COLOR[self.fw.get_policy('incoming')])
280+ self.add_to_log(_("Incoming: ") + self.incoming.get_active_text(), self.POLICY2COLOR[self.frontend.get_policy('incoming')])
281 self.set_statusbar_msg(_("Incoming policy changed"))
282- if self.fw.get_policy('incoming') != self.NUM2POLICY[self.incoming.get_active()].lower():
283+ if self.frontend.get_policy('incoming') != self.NUM2POLICY[self.incoming.get_active()].lower():
284 self.show_dialog(self.winMain, _("There was an error changing the incoming policy"), _("Restart your firewall to refresh to the real status\nand please report this bug"))
285
286 def on_outgoing_changed(self, widget, data=None):
287- self.fw.set_policy('outgoing', self.NUM2POLICY[self.outgoing.get_active()].lower())
288+ self.frontend.set_policy('outgoing', self.NUM2POLICY[self.outgoing.get_active()].lower())
289 self._set_shield()
290- self.add_to_log(_("Outgoing: ") + self.outgoing.get_active_text(), self.POLICY2COLOR[self.fw.get_policy('outgoing')])
291+ self.add_to_log(_("Outgoing: ") + self.outgoing.get_active_text(), self.POLICY2COLOR[self.frontend.get_policy('outgoing')])
292 self.set_statusbar_msg(_("Outgoing policy changed"))
293- if self.fw.get_policy('outgoing') != self.NUM2POLICY[self.outgoing.get_active()].lower():
294+ if self.frontend.get_policy('outgoing') != self.NUM2POLICY[self.outgoing.get_active()].lower():
295 self.show_dialog(self.winMain, _("There was an error changing the outgoing policy"), _("Restart your firewall to refresh to the real status\nand please report this bug"))
296
297 def on_routed_changed(self, widget, data=None):
298 try: # Could be inconsistent between imports and changes of Routed status
299- self.fw.set_policy('routed', self.NUM2POLICY[self.routed.get_active()].lower())
300+ self.frontend.set_policy('routed', self.NUM2POLICY[self.routed.get_active()].lower())
301 except Exception:
302 return
303 self._set_shield()
304 # Translators: Routed firewall changed
305- self.add_to_log(_("Routed: ") + self.routed.get_active_text(), self.POLICY2COLOR[self.fw.get_policy('routed')])
306+ self.add_to_log(_("Routed: ") + self.routed.get_active_text(), self.POLICY2COLOR[self.frontend.get_policy('routed')])
307 self.set_statusbar_msg(_("Routed policy changed"))
308- if self.fw.get_policy('routed') != self.NUM2POLICY[self.routed.get_active()].lower():
309+ if self.frontend.get_policy('routed') != self.NUM2POLICY[self.routed.get_active()].lower():
310 self.show_dialog(self.winMain, _("There was an error changing the routed policy"), _("Restart your firewall to refresh to the real status\nand please report this bug"))
311
312 def on_btnAddRule_clicked(self, widget, data=None):
313@@ -539,10 +539,10 @@
314 self.listening.set_pause(False)
315
316 def on_switchStatus_active_notify(self, widget, data=None):
317- self.fw.set_status(self.switchStatus.get_active())
318- self.print_rules(self.fw.get_rules(False))
319+ self.frontend.set_status(self.switchStatus.get_active())
320+ self.print_rules(self.frontend.get_rules(False))
321
322- if self.fw.get_status():
323+ if self.frontend.get_status():
324 # Translators: About firewall
325 self.add_to_log(_("Status: Enabled"), self.GREEN)
326 self.set_statusbar_msg(_("Firewall enabled"))
327@@ -551,15 +551,15 @@
328 self.add_to_log(_("Status: Disabled"), self.RED)
329 self.set_statusbar_msg(_("Firewall disabled"))
330
331- self.incoming.set_sensitive(self.fw.get_status())
332- self.outgoing.set_sensitive(self.fw.get_status())
333- self.routed.set_sensitive(self.fw.get_status())
334- self.show_add_btn.set_sensitive(self.fw.get_status())
335- self.detele_rule_btn.set_sensitive(self.fw.get_status())
336- self.edit_rule_btn.set_sensitive(self.fw.get_status())
337- self.report_rule_btn.set_sensitive(self.fw.get_status())
338+ self.incoming.set_sensitive(self.frontend.get_status())
339+ self.outgoing.set_sensitive(self.frontend.get_status())
340+ self.routed.set_sensitive(self.frontend.get_status())
341+ self.show_add_btn.set_sensitive(self.frontend.get_status())
342+ self.detele_rule_btn.set_sensitive(self.frontend.get_status())
343+ self.edit_rule_btn.set_sensitive(self.frontend.get_status())
344+ self.report_rule_btn.set_sensitive(self.frontend.get_status())
345 self._set_shield()
346- if self.fw.get_status() != self.switchStatus.get_active():
347+ if self.frontend.get_status() != self.switchStatus.get_active():
348 self.show_dialog(self.winMain, _("There was an error changing the firewall status"), _("Restart your firewall to refresh to the real status and please report this bug"))
349
350 def on_btnDeleteRule_clicked(self, widget, data=None):
351@@ -574,16 +574,16 @@
352 total_rules = sorted(total_rules, key=int, reverse=True)
353
354 # Confirm?
355- if (self.fw.get_config_value('ConfirmDeteleRule') == 'yes') and (len(total_rules) > 0):
356+ if (self.frontend.get_config_value('ConfirmDeteleRule') == 'yes') and (len(total_rules) > 0):
357 answer = self._show_question(self.winMain, _("Delete rule"), _("You will delete all selected rules"), _("Do you want to continue?"))
358 if not answer:
359 return
360
361 for row in total_rules:
362 rules_selected = True
363- rules_before = self.fw.get_rules()
364- cmd = self.fw.delete_rule(row)
365- rules_after = self.fw.get_rules()
366+ rules_before = self.frontend.get_rules()
367+ cmd = self.frontend.delete_rule(row)
368+ rules_after = self.frontend.get_rules()
369
370 if len(rules_before) != len(rules_after):
371 self.add_to_log(cmd[0])
372@@ -594,7 +594,7 @@
373 self.set_statusbar_msg(_("Error. Review Gufw Log"))
374
375 if rules_selected:
376- self.print_rules(self.fw.get_rules())
377+ self.print_rules(self.frontend.get_rules())
378 else:
379 self.show_dialog(self.winMain, _("No rule selected"), _("You have to select a rule"))
380
381@@ -638,15 +638,15 @@
382 updatewin = Update(self, ufw_row, description, cmd, policy, direction, proto, from_ip, from_port, to_ip, to_port, iface, routed, logging)
383
384 def on_profile_changed(self, widget, data=None):
385- operation = self.fw.set_profile(self.profile.get_active_text())
386+ operation = self.frontend.set_profile(self.profile.get_active_text())
387 self.add_to_log(_("Changing profile: ") + self.profile.get_active_text())
388
389- self.incoming.set_active(self.POLICY2NUM[self.fw.get_policy('incoming')])
390- self.outgoing.set_active(self.POLICY2NUM[self.fw.get_policy('outgoing')])
391- self.routed.set_active(self.POLICY2NUM[self.fw.get_policy('routed')])
392- self.switchStatus.set_active(self.fw.get_status())
393+ self.incoming.set_active(self.POLICY2NUM[self.frontend.get_policy('incoming')])
394+ self.outgoing.set_active(self.POLICY2NUM[self.frontend.get_policy('outgoing')])
395+ self.routed.set_active(self.POLICY2NUM[self.frontend.get_policy('routed')])
396+ self.switchStatus.set_active(self.frontend.get_status())
397
398- self.print_rules(self.fw.get_rules())
399+ self.print_rules(self.frontend.get_rules())
400
401 for msg in operation:
402 self.add_to_log(msg)
403@@ -687,11 +687,11 @@
404 return self.txt_tag_black
405
406 def add_to_log(self, msg, color=BLACK, force_save=True):
407- if not self.fw.get_logging():
408+ if not self.frontend.get_logging():
409 return
410
411 if force_save:
412- new_line = self.fw.add_to_log(msg)
413+ new_line = self.frontend.add_to_log(msg)
414 self.log_txt.insert_with_tags(self.log_txt.get_start_iter(), new_line, self._get_log_color(color))
415 else:
416 self.log_txt.insert_with_tags(self.log_txt.get_end_iter(), msg, self._get_log_color(color))
417@@ -702,7 +702,7 @@
418
419 def print_rules(self, rules):
420 self.rules_model.clear()
421- if not self.fw.get_status():
422+ if not self.frontend.get_status():
423 return
424
425 row = 1
426@@ -800,10 +800,10 @@
427
428 width = 0
429 height = 0
430- if self.fw.get_config_value('WindowWidth'):
431- width = int(self.fw.get_config_value('WindowWidth'))
432- if self.fw.get_config_value('WindowHeight'):
433- height = int(self.fw.get_config_value('WindowHeight'))
434+ if self.frontend.get_config_value('WindowWidth'):
435+ width = int(self.frontend.get_config_value('WindowWidth'))
436+ if self.frontend.get_config_value('WindowHeight'):
437+ height = int(self.frontend.get_config_value('WindowHeight'))
438
439 if width >= Gdk.Screen.width() and height >= Gdk.Screen.height():
440 win.maximize()
441@@ -812,8 +812,8 @@
442
443 def _save_window_size(self, win):
444 width, height = win.get_size()
445- self.fw.set_config_value('WindowWidth', str(width))
446- self.fw.set_config_value('WindowHeight', str(height))
447+ self.frontend.set_config_value('WindowWidth', str(width))
448+ self.frontend.set_config_value('WindowHeight', str(height))
449
450 def validate_rule(self, win, from_ip, from_port, to_ip, to_port, insert='', routed=''):
451 # At least 1 Port/IP
452@@ -826,7 +826,7 @@
453 insert_into = 0
454 else:
455 insert_into = int(insert)
456- if insert_into > 0 and insert_into > self.fw.get_number_rules():
457+ if insert_into > 0 and insert_into > self.frontend.get_number_rules():
458 self.show_dialog(win, _("Insert number bigger that number of rules"), _("By example, if you have 3 rules, you can't insert a rule into position 4"))
459 return False
460
461
462=== modified file 'gufw/gufw/view/listening.py'
463--- gufw/gufw/view/listening.py 2019-05-01 08:45:59 +0000
464+++ gufw/gufw/view/listening.py 2019-05-11 17:52:09 +0000
465@@ -34,8 +34,8 @@
466
467 self._show_report()
468
469- if self.gufw.fw.get_config_value('RefreshInterval'):
470- time = int(self.gufw.fw.get_config_value('RefreshInterval'))
471+ if self.gufw.frontend.get_config_value('RefreshInterval'):
472+ time = int(self.gufw.frontend.get_config_value('RefreshInterval'))
473 else:
474 time = REFRESH_TIME
475 GLib.timeout_add((time * 1000), self._show_report)
476@@ -44,7 +44,7 @@
477 if not self.running_listening:
478 return False
479
480- report = self.gufw.fw.get_listening_report()
481+ report = self.gufw.frontend.get_listening_report()
482 self._view_report(report, self.previous_report)
483 self.previous_report = report
484
485@@ -85,7 +85,7 @@
486 self.gufw.listening_model.set_value(iter_row, 3, line_split[3].strip()) # app
487 self.gufw.listening_model.set_value(iter_row, 5, row) # number
488
489- if self.gufw.fw.get_status():
490+ if self.gufw.frontend.get_status():
491 if line_split[4] == 'allow':
492 self.gufw.listening_model.set_value(iter_row, 4, self.gufw.RED)
493 elif line_split[4] == 'deny':
494
495=== modified file 'gufw/gufw/view/preferences.py'
496--- gufw/gufw/view/preferences.py 2019-05-01 08:45:59 +0000
497+++ gufw/gufw/view/preferences.py 2019-05-11 17:52:09 +0000
498@@ -60,20 +60,20 @@
499 self.list_selection = self.builder.get_object('profiles_selection')
500
501 def _set_initial_values(self):
502- self.ufw_logging.set_active(UFW_LEVEL2NUM[self.gufw.fw.get_ufw_logging()])
503- if self.gufw.fw.get_logging():
504+ self.ufw_logging.set_active(UFW_LEVEL2NUM[self.gufw.frontend.get_ufw_logging()])
505+ if self.gufw.frontend.get_logging():
506 self.gufw_logging.set_active(True)
507- if self.gufw.fw.get_config_value('ConfirmDeteleRule') == 'yes':
508+ if self.gufw.frontend.get_config_value('ConfirmDeteleRule') == 'yes':
509 self.gufw_confirm_delete.set_active(True)
510
511- if self.gufw.fw.get_config_value('RefreshInterval'):
512- self.report_interval.set_value(int(self.gufw.fw.get_config_value('RefreshInterval')))
513+ if self.gufw.frontend.get_config_value('RefreshInterval'):
514+ self.report_interval.set_value(int(self.gufw.frontend.get_config_value('RefreshInterval')))
515 else:
516 self.report_interval.set_value(3)
517
518 # Profiles (model)
519 self.profile_rows = Gtk.ListStore(str)
520- for profile in self.gufw.fw.get_all_profiles():
521+ for profile in self.gufw.frontend.get_all_profiles():
522 self.profile_rows.append([profile])
523 self.list_profiles.set_model(self.profile_rows)
524 # Profiles (Editable one column)
525@@ -109,11 +109,11 @@
526 return
527 # Not the default
528 previous_name = self.profile_rows[path][0]
529- if previous_name == self.gufw.fw.get_profile():
530+ if previous_name == self.gufw.frontend.get_profile():
531 self.gufw.show_dialog(self.win_preferences, _("Current profile"), _("You can't rename the current profile"))
532 return
533
534- self.gufw.fw.rename_profile(self.profile_rows[path][0], new_name)
535+ self.gufw.frontend.rename_profile(self.profile_rows[path][0], new_name)
536 self.profile_rows[path][0] = new_name
537 self.gufw.profile.remove(int(path))
538 self.gufw.profile.insert_text(int(path), new_name)
539@@ -131,8 +131,8 @@
540 exist_profile = True
541 break # Next ind
542
543- self.gufw.fw.add_profile(new_name)
544- ind = self.gufw.fw.get_all_profiles().index(new_name)
545+ self.gufw.frontend.add_profile(new_name)
546+ ind = self.gufw.frontend.get_all_profiles().index(new_name)
547 self.profile_rows.append([new_name])
548 self.gufw.profile.append_text(new_name)
549 self.gufw.add_to_log(_("Created Profile: ") + new_name)
550@@ -143,32 +143,32 @@
551 self.gufw.show_dialog(self.win_preferences, _("Select a profile"), _("You need to select a profile for deleting"))
552 else:
553 deleted_profile = model.get_value(treeiter, 0)
554- if deleted_profile == self.gufw.fw.get_profile():
555+ if deleted_profile == self.gufw.frontend.get_profile():
556 self.gufw.show_dialog(self.win_preferences, _("Profile not erasable"), _("You can't remove the current profile"))
557 else:
558- self.gufw.profile.remove(self.gufw.fw.get_all_profiles().index(deleted_profile))
559- self.gufw.fw.delete_profile(deleted_profile)
560+ self.gufw.profile.remove(self.gufw.frontend.get_all_profiles().index(deleted_profile))
561+ self.gufw.frontend.delete_profile(deleted_profile)
562 self.profile_rows.remove(treeiter)
563 self.gufw.add_to_log(_("Deleted Profile: ") + deleted_profile)
564
565 def on_ufw_logging_changed(self, widget, data=None):
566- self.gufw.fw.set_ufw_logging(NUM2UFW_LEVEL[self.ufw_logging.get_active()])
567+ self.gufw.frontend.set_ufw_logging(NUM2UFW_LEVEL[self.ufw_logging.get_active()])
568 self.gufw.add_to_log(_("ufw Logging: ") + self.ufw_logging.get_active_text())
569
570 def on_gufw_logging_toggled(self, widget, data=None):
571 if self.gufw_logging.get_active():
572- self.gufw.fw.set_logging(True)
573+ self.gufw.frontend.set_logging(True)
574 self.gufw.add_to_log(_("Gufw Logging: Enabled"))
575 else:
576 self.gufw.add_to_log(_("Gufw Logging: Disabled"))
577- self.gufw.fw.set_logging(False)
578+ self.gufw.frontend.set_logging(False)
579
580 def on_gufw_confirm_delete_toggled(self, widget, data=None):
581 if self.gufw_confirm_delete.get_active():
582- self.gufw.fw.set_config_value('ConfirmDeteleRule', 'yes')
583+ self.gufw.frontend.set_config_value('ConfirmDeteleRule', 'yes')
584 self.gufw.add_to_log(_("Confirm Delete Dialog: Enabled"))
585 else:
586- self.gufw.fw.set_config_value('ConfirmDeteleRule', 'no')
587+ self.gufw.frontend.set_config_value('ConfirmDeteleRule', 'no')
588 self.gufw.add_to_log(_("Confirm Delete Dialog: Disabled"))
589
590 def on_close_btn_clicked(self, widget, data=None):
591@@ -179,6 +179,6 @@
592
593 def on_report_interval_scale_button_release_event(self, widget, data=None):
594 refresh_time = int(self.report_interval.get_value())
595- self.gufw.fw.set_config_value('RefreshInterval', refresh_time)
596+ self.gufw.frontend.set_config_value('RefreshInterval', refresh_time)
597 # Translators: Refresh the live traffic on GUI
598 self.gufw.add_to_log(_("Refresh Interval: ") + str(refresh_time) + '"')
599
600=== modified file 'gufw/gufw/view/update.py'
601--- gufw/gufw/view/update.py 2019-05-01 08:45:59 +0000
602+++ gufw/gufw/view/update.py 2019-05-11 17:52:09 +0000
603@@ -63,7 +63,7 @@
604 self.builder.connect_signals(self)
605 self.win_update.show_all()
606
607- if self.gufw.fw.get_policy('routed') == 'disabled':
608+ if self.gufw.frontend.get_policy('routed') == 'disabled':
609 self.update_routed_img.set_visible(False)
610 self.update_routed.set_visible(False)
611
612@@ -103,7 +103,7 @@
613 # Translators: About the network interfaces in the OS
614 self.update_iface.append_text(_("All Interfaces"))
615 self.update_routed.append_text(_("Not Forward"))
616- for ifaceName in self.gufw.fw.get_net_interfaces():
617+ for ifaceName in self.gufw.frontend.get_net_interfaces():
618 self.update_iface.append_text(ifaceName)
619 self.update_routed.append_text(ifaceName)
620 if ifaceName == self.rule_iface:
621@@ -165,10 +165,10 @@
622 self.win_update.destroy()
623
624 def on_update_copy_from_IP_clicked(self, widget, data=None):
625- self.update_from_ip.set_text(self.gufw.fw.get_internal_ip())
626+ self.update_from_ip.set_text(self.gufw.frontend.get_internal_ip())
627
628 def on_update_copy_to_IP_clicked(self, widget, data=None):
629- self.update_to_ip.set_text(self.gufw.fw.get_internal_ip())
630+ self.update_to_ip.set_text(self.gufw.frontend.get_internal_ip())
631
632 def on_update_rule_name_icon_press(self, widget, data=None, data2=None):
633 self.update_rule_name.set_text('')
634@@ -195,11 +195,11 @@
635 self.update_routed.set_tooltip_text(_("You need to set an Interface for forwarding to this another interface"))
636
637 # Not allow same iface when is routed
638- if self.gufw.fw.get_policy('routed') != 'disabled':
639+ if self.gufw.frontend.get_policy('routed') != 'disabled':
640 self.update_routed.remove_all()
641 # Translators: About traffic
642 self.update_routed.append_text(_("Not Forward"))
643- for ifaceName in self.gufw.fw.get_net_interfaces(self.update_iface.get_active_text()):
644+ for ifaceName in self.gufw.frontend.get_net_interfaces(self.update_iface.get_active_text()):
645 self.update_routed.append_text(ifaceName)
646 self.update_routed.set_active(0)
647
648@@ -254,17 +254,17 @@
649 # Delete the same rules
650 same_rules_rows = self._get_same_rules(self.rule_cmd)
651 for same_row in same_rules_rows:
652- cmd = self.gufw.fw.delete_rule(same_row)
653+ cmd = self.gufw.frontend.delete_rule(same_row)
654 self.gufw.add_to_log(_("Editing rule (Removing): ") + new_description + ' | ' + cmd[0] + ' > ' + cmd[1].replace('\n', ' | '))
655
656 # Add new
657 insert_row = ''
658- cmd = self.gufw.fw.add_rule(new_description, insert_row, new_policy, new_direction, new_iface, new_routed, new_logging, new_proto, new_from_ip, new_from_port, new_to_ip, new_to_port)
659+ cmd = self.gufw.frontend.add_rule(new_description, insert_row, new_policy, new_direction, new_iface, new_routed, new_logging, new_proto, new_from_ip, new_from_port, new_to_ip, new_to_port)
660
661 self.gufw.add_to_log(_("Editing rule (Adding): ") + new_description + ' | ' + cmd[1] + ' > ' + cmd[2].replace('\n', ' | '), self.gufw.POLICY2COLOR[new_policy])
662 self.gufw.set_statusbar_msg(_("Updated rule ") + str(self.ufw_row))
663
664- self.gufw.print_rules(self.gufw.fw.get_rules())
665+ self.gufw.print_rules(self.gufw.frontend.get_rules())
666 self.win_update.destroy()
667
668 def _get_same_rules(self, rule_cmd):

Subscribers

People subscribed via source and target branches

to all changes: