Пример #1
0
 def resetModes(self):
     self.logger().show()
     try:
         attr = self.getModel()
         schema = self.getSchema()
         print('%s: resetModes(%s)' % (fun.time2str(), attr))
         qm = Qt.QMessageBox(Qt.QMessageBox.Warning, 'Confirmation',
                             '%s archiving will be stopped' % attr,
                             Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel)
         r = qm.exec_()
         if r == Qt.QMessageBox.Ok:
             if not self.api:
                 self.api = pta.api(self.getSchema().lower(),
                                    logger=self.logger())
             self.api.log = self.logger()
             #self.emit(Qt.SIGNAL('archive'),attr,modes)
             Qt.QApplication.instance().setOverrideCursor(
                 Qt.QCursor(Qt.Qt.WaitCursor))
             thr = threading.Thread(target=self.startArchiving,
                                    args=(attr, {}))
             QLoggerDialog._threads = filter(Thread.is_alive,
                                             self.threads()) + [thr]
             thr.start()
         else:
             self.logger().hide()
     except:
         traceback.print_exc()
     print('%s: resetModes(...): running!' % (fun.time2str()))
Пример #2
0
 def applyModes(self):
     self.logger().show()
     #Qt.QApplication.instance().setOverrideCursor(Qt.QCursor(Qt.Qt.WaitCursor))
     try:
         attr = self.getModel()
         v = F.check_attribute(attr, brief=True)
         if isinstance(v, (type(None), Exception)):
             Qt.QMessageBox.warning(
                 self, "Warning",
                 "%s is not readable nor archivable" % attr)
             self.logger().hide()
             return
         if fun.isSequence(v) or fun.isString(v):
             Qt.QMessageBox.warning(self, "Warning",
                                    "%s array type is not supported" % attr)
             self.logger().hide()
             return
         modes = self.getModes() or {'MODE_P': [60000]}
         schema = self.getSchema()
         print('%s: applyModes(%s)' % (fun.time2str(), modes))
         msg = 'Modes to be applied:\n'
         for m, v in modes.items():
             msg += '\t%s.%s: %s\n' % (schema, m, v)
         qm = Qt.QMessageBox(Qt.QMessageBox.Warning, 'Confirmation', msg,
                             Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel)
         r = qm.exec_()
         if r == Qt.QMessageBox.Ok:
             if not self.api:
                 self.api = pta.api(self.getSchema().lower(),
                                    logger=self.logger())
             self.api.log = self.logger()
             #self.emit(Qt.SIGNAL('archive'),attr,modes)
             Qt.QApplication.instance().setOverrideCursor(
                 Qt.QCursor(Qt.Qt.WaitCursor))
             thr = threading.Thread(target=self.startArchiving,
                                    args=(attr, modes))
             QLoggerDialog._threads = filter(Thread.is_alive,
                                             self.threads()) + [thr]
             thr.start()
         else:
             self.logger().hide()
     except:
         self.logger().error(traceback.print_exc())
     print('%s: applyModes(...): running!' % (fun.time2str()))
Пример #3
0
    def init_ui(self, parent, mainwindow):

        try:
            PARENT_CLASS.__init__(self, parent)
            self._connected = False
            self._ui = Ui_AlarmList()
            self._ui.setupUi(self)
            if mainwindow:
                mainwindow = self.init_mw(mainwindow)
            self.mainwindow = mainwindow

            url = os.path.dirname(
                panic.__file__) + '/gui/icon/panic-6-banner.png'
            trace('... splash ...')
            px = Qt.QPixmap(url)
            self.splash = Qt.QSplashScreen(px)
            self.splash.showMessage('initializing application...')
            self.splash.show()
            trace('showing splash ... %s' % px.size())

        except:
            print traceback.format_exc()

        if self.mainwindow:

            self.mainwindow.setWindowTitle(
                'PANIC %s (%s[%s]@%s)' %
                (panic.__RELEASE__, self.scope, self.default_regEx,
                 fn.get_tango_host().split(':')[0]))

            icon = '/gui/icon/panic-6-big.png'  #'.svg'
            url = os.path.dirname(panic.__file__) + icon
            px = Qt.QPixmap(url)
            self.mainwindow.setWindowIcon(Qt.QIcon(px))

        self.setExpertView(True)

        self._message = Qt.QMessageBox(self)
        self._message.setWindowTitle("Empty fields")
        self._message.setIcon(Qt.QMessageBox.Critical)