Esempio n. 1
0
 def add_xembed_tabs(self):
     if INFO.TAB_CMDS:
         from qtvcp.widgets.xembed import XEmbeddable
         for name, tab, cmd in INFO.ZIPPED_TABS:
             LOG.debug('Processing Embedded tab:{}, {}, {}'.format(
                 name, tab, cmd))
             if tab == 'default':
                 tab = 'rightTab'
             if not isinstance(self.QTVCP_INSTANCE_[tab],
                               QtWidgets.QTabWidget):
                 LOG.warning(
                     'tab location {} is not a QTabWidget - skipping'.
                     format(tab))
                 continue
             try:
                 temp = XEmbeddable()
                 temp.embed(cmd)
             except Exception, e:
                 LOG.error('Embedded tab loading failed: {}'.format(name))
             else:
                 try:
                     self.QTVCP_INSTANCE_[tab].addTab(temp, name)
                 except Exception, e:
                     LOG.error('Embedded tab adding widget into {} failed.'.
                               format(tab))
Esempio n. 2
0
 def _embed(self, cmd, loc, twidget):
     if twidget is None:
         tw = QtWidgets.QWidget()
         tw.setMinimumSize(400, 200)
         self.QTVCP_INSTANCE_[loc].addWidget(tw)
     try:
         temp = XEmbeddable()
         temp.embed(cmd)
     except Exception as e:
         LOG.error('Embedded tab loading failed: {} {}'.format(cmd, e))
     else:
         if twidget is not None:
             try:
                 if loc == 'rightPanel':
                     self.QTVCP_INSTANCE_[loc].setMaximumSize(400, 30000)
                     self.QTVCP_INSTANCE_[loc].setMinimumSize(400, 0)
                 layout = QtWidgets.QGridLayout(twidget)
                 layout.addWidget(temp, 0, 0)
             except Exception as e:
                 LOG.error(
                     'Embedded tab adding widget into {} failed.'.format(
                         loc))
         else:
             layout = QtWidgets.QGridLayout(tw)
             layout.addWidget(temp, 0, 0)
Esempio n. 3
0
    def add_xembed_tabs(self):
        if INFO.TAB_CMDS:
            wid = int(self.QTVCP_INSTANCE_.winId())
            os.environ['QTVCP_FORWARD_EVENTS_TO'] = str(wid)

            from qtvcp.widgets.xembed import XEmbeddable
            for name, loc, cmd in INFO.ZIPPED_TABS:
                LOG.debug('Processing Embedded tab:{}, {}, {}'.format(name,loc,cmd))
                if loc == 'default':
                    loc = 'rightTab'
                if isinstance(self.QTVCP_INSTANCE_[loc], QtWidgets.QTabWidget):
                    tw = QtWidgets.QWidget()
                    self.QTVCP_INSTANCE_[loc].addTab(tw, name)
                elif isinstance(self.QTVCP_INSTANCE_[loc], QtWidgets.QStackedWidget):
                    tw = QtWidgets.QWidget()
                    self.QTVCP_INSTANCE_[loc].addWidget(tw)
                else:
                    LOG.warning('tab location {} is not a Tab or stacked Widget - skipping'.format(loc))
                    continue
                try:
                    temp = XEmbeddable()
                    temp.embed(cmd)
                except Exception, e:
                    LOG.error('Embedded tab loading failed: {} {}'.format(name,e))
                else:
                    try:
                        layout = QtWidgets.QGridLayout(tw)
                        layout.addWidget(temp, 0, 0)
                    except Exception, e:
                        LOG.error('Embedded tab adding widget into {} failed.'.format(loc))
Esempio n. 4
0
 def _embed(self, cmd, loc, twidget):
     if twidget is None:
         tw = QtWidgets.QWidget()
         tw.setMinimumSize(400, 200)
         self.QTVCP_INSTANCE_[loc].addWidget(tw)
     try:
         temp = XEmbeddable()
         temp.embed(cmd)
     except Exception, e:
         LOG.error('Embedded tab loading failed: {} {}'.format(cmd, e))
Esempio n. 5
0
 def add_xembed_tabs(self):
     if INFO.TAB_CMDS:
         from qtvcp.widgets.xembed import XEmbeddable
         for name, tab, cmd in INFO.ZIPPED_TABS:
             LOG.debug('Processing Embedded tab:{}, {}, {}'.format(name,tab,cmd))
             if tab == 'default':
                 tab = 'rightTab'
             if not isinstance(self.QTVCP_INSTANCE_[tab], QtWidgets.QTabWidget):
                 LOG.warning('tab location {} is not a QTabWidget - skipping'.format(tab))
                 continue
             try:
                 temp = XEmbeddable()
                 temp.embed(cmd)
             except Exception, e:
                 LOG.error('Embedded tab loading failed: {}'.format(name))
             else:
                 try:
                     self.QTVCP_INSTANCE_[tab].addTab(temp, name)
                 except Exception, e:
                     LOG.error('Embedded tab adding widget into {} failed.'.format(tab))