Logo Search packages:      
Sourcecode: harpia version File versions  Download package

def harpia::harpiagcfrontend::S2iHarpiaFrontend::on_Export_clicked (   self,
  args 
)

Callback function called when Export is clicked. Calls the Execute function in s2ipngexport class, that saves a blocks diagram in a .png file.

Definition at line 836 of file harpiagcfrontend.py.

00836                                         :
            """
            Callback function called when Export is clicked. Calls the Execute function in s2ipngexport class, that saves a blocks diagram in a .png file.
            """

            if self.m_oGcDiagrams.has_key( self.widgets['WorkArea'].get_current_page() ): 

                  t_oGcDiagram = self.m_oGcDiagrams[self.widgets['WorkArea'].get_current_page()]
                  t_oDialog = gtk.FileChooserDialog(_("Export Diagram to PNG..."),
                                                                  None,
                                                                  gtk.FILE_CHOOSER_ACTION_SAVE,
                                                                  (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                                                  gtk.STOCK_SAVE, gtk.RESPONSE_OK))
            
                  t_oDialog.set_default_response(gtk.RESPONSE_OK)

                  if os.name == 'posix':
                        t_oDialog.set_current_folder(os.path.expanduser("~"))

                  t_oFilter = gtk.FileFilter()
                  t_oFilter.set_name(_("Png files"))
                  t_oFilter.add_pattern("*.png")
                  t_oDialog.add_filter(t_oFilter)
                  
                  t_oResponse = t_oDialog.run()
                  
                  filename = t_oDialog.get_filename()
                  
                  if not filename.endswith(".png"):
                        filename += ".png"
                  t_oDialog.destroy()
                  
                  
                  while gtk.events_pending():
                        gtk.main_iteration(False)
                  
                  if t_oResponse == gtk.RESPONSE_OK:
                        del t_oResponse
                        del t_oDialog
                        while gtk.events_pending():
                              gtk.main_iteration(False)
                        t_oGcDiagram.Export2Png(filename)

      
      #----------------------------------------------------------------------


Generated by  Doxygen 1.6.0   Back to index