def _tacma_data_changed(self, event, iden): if event == 'ActiveTaskChanged': if iden is None: self.setIcon(bproc.get_icon('icon-stop')) self.setToolTip('') else: self.setIcon(bproc.get_icon('icon-run')) self.setToolTip('%s' % self.data._gai(iden).name) self.menu.refresh_checkboxes()
def _tacma_data_changed(self, event, iden): if event == 'ActiveTaskChanged': if iden is None: self.setToolTip('no task') self.setIcon(bproc.get_icon('icon-stop')) else: self.setToolTip('%s' % self.data._gai(iden).name) self.setIcon(bproc.get_icon('icon-run')) self.menu.refresh_checkboxes()
def __init__(self, mw): 'mw - MainWindow' super(TrayIcon, self).__init__(bproc.get_icon('icon-stop'), QtWidgets.qApp) self.win = mw self.data = mw.data self.data.emitter.subscribe(self, self._tacma_data_changed) self.setupUI()
def __init__(self, mw): 'mw - MainWindow' super(TrayIcon, self).__init__(bproc.get_icon('icon-stop'), QtWidgets.qApp) self.win = mw self.data = mw.data self.data.emitter.subscribe(self, self._tacma_data_changed) self.setupUI() self.setToolTip('no task')
def setUi(self): 'initialize widgets' self.setWindowTitle(tacmaopt.opt.title()) self.setWindowIcon(bproc.get_icon('tacma')) self.resize(tacmaopt.opt.Hx, tacmaopt.opt.Hy) self.move(tacmaopt.opt.x0, tacmaopt.opt.y0) #menu menubar = self.menuBar() filemenu = menubar.addMenu('&File') exit_action = QtWidgets.QAction('E&xit', self) exit_action.setShortcut(QtGui.QKeySequence.Close) exit_action.triggered.connect(QtWidgets.qApp.quit) filemenu.addAction(exit_action) #central widget self.tab = MainWindowTable(self.data, self) self.setCentralWidget(self.tab)
def setUi(self): # NOQA 'initialize widgets' self.setWindowTitle(tacmaopt.opt.title()) self.setWindowIcon(bproc.get_icon('tacma')) self.resize(tacmaopt.opt.Hx, tacmaopt.opt.Hy) self.move(tacmaopt.opt.x0, tacmaopt.opt.y0) #menu menubar = self.menuBar() filemenu = menubar.addMenu('&File') exit_action = QtWidgets.QAction('E&xit', self) exit_action.setShortcut(QtGui.QKeySequence.Close) exit_action.triggered.connect(QtWidgets.qApp.quit) filemenu.addAction(exit_action) viewmenu = menubar.addMenu('&View') viewsubs = [None] * len(ViewModel.cnames) for k, v in ViewModel.cnames.iteritems(): if v[1] == '': continue act1 = QtWidgets.QAction(v[1], self) act1.setCheckable(True) act1.triggered.connect(functools.partial( self.set_column_visible, v[0], k)) if k in tacmaopt.opt.colvisible: act1.setChecked(tacmaopt.opt.colvisible[k]) else: act1.setChecked(True) viewsubs[v[0]] = act1 for v in viewsubs: if v is not None: viewmenu.addAction(v) #central widget self.tab = MainWindowTable(self.data, self) self.setCentralWidget(self.tab)