Ejemplo n.º 1
0
 def _file_op(self, oper, attr, label):
     try:
         getattr(oper, attr)()
         return True
     except IOError, err:
         hig.error("There was an error trying to %s the document" % label,
                   str(err), parent=self.get_window())
Ejemplo n.º 2
0
 def _file_op(self, oper, attr, label):
     try:
         getattr(oper, attr)()
         return True
     except IOError, err:
         hig.error("There was an error trying to %s the document" % label,
                   str(err),
                   parent=self.get_window())
Ejemplo n.º 3
0
 def show_exception(self, exctype, value, tb):
     if exctype is errors.ServiceNotFoundError:
         svcname = value.args[0]
         pt = 'Tried to access non-existing service "%s"' % svcname
         st = ('PIDA tried to find a service that is not loaded'
               '. Most likely this is due to a missing dependency'
               '. Please check the file:\n\n'
               '<tt>~/.pida/log/pida.log</tt>')
         if svcname in [
                 'window', 'buffermanager', 'contexts', 'editormanager'
         ]:
             st = ('%s\n\n<span color="#c03030">'
                   'The service "%s" is critical.</span>\n\n'
                   '<b>PIDA will not run without it</b>' % (st, svcname))
             hig.error(pt, st, title='Service Not Found')
         else:
             hig.warning(pt, st, title='Service Not Found')
         return True
     else:
         self.unhandled_exception(exctype, value, tb)
Ejemplo n.º 4
0
 def show_exception(self, exctype, value, tb):
     if exctype is errors.ServiceNotFoundError:
         svcname = value.args[0]
         pt = 'Tried to access non-existing service "%s"' % svcname
         st = ('PIDA tried to find a service that is not loaded'
               '. Most likely this is due to a missing dependency'
               '. Please check the file:\n\n'
               '<tt>~/.pida/logs/pida.log</tt>')
         if svcname in ['window', 'buffermanager', 'contexts',
                      'editormanager']:
             st = ('%s\n\n<span color="#c03030">'
                   'The service "%s" is critical.</span>\n\n'
                   '<b>PIDA will not run without it</b>'
                   % (st, svcname))
             hig.error(pt, st, title='Service Not Found')
         else:
             hig.warning(pt, st, title='Service Not Found')
         return True
     else:
         self.unhandled_exception(exctype, value, tb)
Ejemplo n.º 5
0
 def cmd_open_file(self, filename, quiet=False):
     """
     Open a filename.
     """
     if (len(filename) and (self.__currentdocument is None or
             filename != self.__currentdocument.filename)):
         document = self.__get_filename_document(filename)
         if document is None:
             try:
                 document = self.__open_file(filename)
             except errors.BadDocument, e:
                 document = None
                 if not quiet:
                     hig.error("Error opening file",
                                e.args[0], run = True,
                                title='Error opening file')
             except Exception:
                 if not quiet:
                     raise
             if document is not None:
                 self.__add_document(document)