Example #1
0
 def save_chain(self):
     if self.state == WindowState.Empty:
         return True
     elif self.state == WindowState.Create:
         return self.save_chain_as()
     else:
         chain.write(self.txtFilterChain.get_text(), self.chain)
         self.set_state_show()
         return True
Example #2
0
 def save_chain_as(self):
     if self.state == WindowState.Empty:
         return True
     dialog = Gtk.FileChooserDialog("Save filterchain", None,
                                Gtk.FileChooserAction.SAVE,
                                (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                 Gtk.STOCK_OK, Gtk.ResponseType.OK))
     response = dialog.run()
     fname = dialog.get_filename()
     dialog.destroy()
     
     if response == Gtk.ResponseType.OK:
         if not fname.endswith('.filterchain'):
             fname += '.filterchain'
         chain.write(fname, self.chain)
         self.txtFilterChain.set_text(fname)
         self.set_state_show()
         return True
     else:
         return False