コード例 #1
0
    def __init__(self, parent, close_button=False, error_window=None):
        QFrame.__init__(self, parent)
        self._enabled = True
        toplo = QVBoxLayout(self)
        toplo.setContentsMargins(0, 0, 0, 0)
        toplo.setSpacing(0)

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        splitter = QSplitter(Qt.Vertical, self)
        toplo.addWidget(splitter)
        splitter.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        splitter.setChildrenCollapsible(False)

        # figure out our app_gui parent
        self._appgui = app_proxy_gui.appgui(parent)

        # create an editor box
        editor_box = QFrame(splitter)
        lo = QVBoxLayout(editor_box)
        lo.setContentsMargins(0, 0, 0, 0)
        lo.setSpacing(0)

        # find main window to associate our toolbar with
        mainwin = parent
        while mainwin and not isinstance(mainwin, QMainWindow):
            mainwin = mainwin.parent()

        self._toolbar = QToolBar(mainwin or self)
        lo.addWidget(self._toolbar)
        self._toolbar.setIconSize(QSize(16, 16))

        #### populate toolbar

        # Exec button and menu
        self._tb_tdlexec = QToolButton(self._toolbar)
        self._toolbar.addWidget(self._tb_tdlexec)
        self._tb_tdlexec.setIcon(pixmaps.gear.icon())
        self._tb_tdlexec.setText("Exec")
        self._tb_tdlexec.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self._tb_tdlexec.setToolTip(
            "Accesses run-time options & jobs defined by this TDL script")
        self._tb_tdlexec.hide()

        jobs = self._tdlexec_menu = TDLOptionsDialog(self)
        jobs.setWindowTitle("TDL Jobs & Runtime Options")
        jobs.setWindowIcon(pixmaps.gear.icon())
        jobs.hide()
        QObject.connect(self._tb_tdlexec, SIGNAL("clicked()"), jobs.exec_)

        # save menu and button
        self._tb_save = QToolButton(self._toolbar)
        self._toolbar.addWidget(self._tb_save)
        self._tb_save.setIcon(pixmaps.file_save.icon())
        self._tb_save.setToolTip(
            "Saves script. Click on the down-arrow for other options.")

        savemenu = QMenu(self)
        self._tb_save.setMenu(savemenu)
        self._tb_save.setPopupMode(QToolButton.MenuButtonPopup)
        self._tb_save._modified_color = QColor("yellow")
        qa_save = savemenu.addAction(pixmaps.file_save.icon(), "&Save script",
                                     self._save_file)
        qa_save.setShortcut(Qt.ALT + Qt.Key_S)
        QObject.connect(self._tb_save, SIGNAL("clicked()"), self._save_file)
        qa_save_as = savemenu.addAction(
            pixmaps.file_save.icon(), "Save script &as...",
            self.curry(self._save_file, save_as=True))
        qa_revert = self._qa_revert = savemenu.addAction(
            "Revert to saved", self._revert_to_saved)

        # run menu and button

        self._qa_run = self._toolbar.addAction(
            pixmaps.blue_round_reload.icon(), "&Save & reload",
            self._import_main_file)
        self._qa_run.setShortcut(Qt.ALT + Qt.Key_R)

        # Compile-time options and menu
        self._tb_opts = QToolButton(self._toolbar)
        self._toolbar.addWidget(self._tb_opts)
        self._tb_opts.setIcon(pixmaps.wrench.icon())
        self._tb_opts.setText("Options")
        self._tb_opts.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self._tb_opts.setToolTip(
            "Accesses compile-time options for this TDL script")
        # self._tb_opts.hide();

        opts = self._options_menu = TDLOptionsDialog(
            self, ok_label="Compile", ok_icon=pixmaps.blue_round_reload)
        opts.setWindowTitle("TDL Compile-time Options")
        opts.setWindowIcon(pixmaps.wrench.icon())
        QObject.connect(opts, PYSIGNAL("accepted()"), self._compile_main_file)
        QObject.connect(TDLOptions.OptionObject, SIGNAL("mandatoryOptionsSet"),
                        self.mark_mandatory_options_set)
        opts.hide()
        QObject.connect(self._tb_opts, SIGNAL("clicked()"), opts.show)
        # cross-connect the rereshProfiles() signals, so that dialogs can update each other's
        # profile menus
        QObject.connect(self._options_menu, PYSIGNAL("refreshProfiles()"),
                        self._tdlexec_menu.refresh_profiles)
        QObject.connect(self._tdlexec_menu, PYSIGNAL("refreshProfiles()"),
                        self._options_menu.refresh_profiles)

        self._toolbar.addSeparator()

        # cursor position indicator
        self._poslabel = QLabel(self._toolbar)
        #wa = QWidgetAction(self._toolbar);
        #wa.setDefaultWidget(self._poslabel);
        #self._toolbar.addAction(wa);
        #self._toolbar.addWidget(self._poslabel);
        self._toolbar.addWidget(self._poslabel)
        width = self._poslabel.fontMetrics().width("L:999 C:999")
        self._poslabel.setMinimumWidth(width)
        self._poslabel.setText("L:0 C:0")

        # filename indicator
        self._pathlabel = QLabel(self._toolbar)
        #wa = QWidgetAction(self._toolbar);
        #wa.setDefaultWidget(self._pathlabel);
        self._toolbar.addWidget(self._pathlabel)
        #self._toolbar.addAction(wa);
        self._pathlabel.show()
        self._pathlabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self._pathlabel.setIndent(10)
        self._pathlabel.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Minimum)
        if close_button:
            if not isinstance(close_button, QIcon):
                close_button = pixmaps.remove.icon()
            self._qa_close = self._toolbar.addAction(close_button,
                                                     "&Close file",
                                                     self._file_closed)
            self._qa_close.setShortcut(Qt.ALT + Qt.Key_W)
        self._pathlabel.setText("(no file)")

        #### add editor window

        self._editor = editor = QTextEdit(editor_box)
        lo.addWidget(self._editor)
        editor.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        editor.setAcceptRichText(False)
        editor.setLineWrapMode(QTextEdit.NoWrap)
        self._document = QTextDocument(self)
        editor.setDocument(self._document)
        QObject.connect(self._document, SIGNAL("modificationChanged(bool)"),
                        self._text_modified)
        QObject.connect(self._editor, SIGNAL("cursorPositionChanged()"),
                        self._display_cursor_position)
        # QObject.connect(self._editor,SIGNAL("textChanged()"),self._clear_transients);

        # add character formats for error display
        self._format_error = QTextCharFormat(self._editor.currentCharFormat())
        self._format_error.setBackground(QBrush(QColor("lightpink")))
        self._format_suberror = QTextCharFormat(
            self._editor.currentCharFormat())
        self._format_suberror.setBackground(QBrush(QColor("lightgrey")))
        self._format_current_error = QTextCharFormat(
            self._editor.currentCharFormat())
        self._format_current_error.setBackground(QBrush(QColor("orangered")))

        # add message window
        self._message_box = QFrame(editor_box)
        lo.addWidget(self._message_box)
        self._message_box.setSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Preferred)
        self._message_box.setFrameStyle(QFrame.Panel + QFrame.Sunken)
        self._message_box.setLineWidth(2)
        mblo = QVBoxLayout(self._message_box)
        mblo.setContentsMargins(0, 0, 0, 0)
        msgb1 = QHBoxLayout()
        mblo.addLayout(msgb1)
        msgb1.setContentsMargins(0, 0, 0, 0)
        msgb1.setSpacing(0)
        self._message_icon = QToolButton(self._message_box)
        msgb1.addWidget(self._message_icon)
        self._message = QLabel(self._message_box)
        msgb1.addWidget(self._message)
        self._message.setTextFormat(Qt.RichText)
        self._message.setWordWrap(True)
        self._message.setMargin(0)
        self._message.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Preferred)
        # self._message_icon.setAlignment(Qt.AlignTop);
        # self._message_icon.setMargin(4);
        self._message_icon.setAutoRaise(True)
        self._message_icon.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        QObject.connect(self._message_icon, SIGNAL("clicked()"),
                        self.clear_message)
        self._message_icon.setToolTip("Click here to clear the message")
        self._message_widgets = []
        self._message_transient = False

        # figure out if we already have an error box to attach to
        self._error_window = error_window or getattr(
            parent, '_tdlgui_error_window', None)
        if self._error_window:
            #self._resize_errwin = False;
            pass
        else:
            # otherwise create an error floater
            self._error_window = TDLErrorFloat(parent)
            setattr(parent, '_tdlgui_error_window', self._error_window)
            # self._resize_errwin = True;
        QObject.connect(self._error_window, PYSIGNAL("hasErrors()"),
                        self._reset_errors)
        QObject.connect(self._error_window, PYSIGNAL("showError()"),
                        self.show_error)

        # set filename
        self._filename = None
        # "official" path of file (None if new script not yet saved)
        self._mainfile = None
        # if not None, then we're "slaved" to a main file (see below)
        self._file_disktime = None
        # modtime on disk when file was loaded
        self._basename = None
        self._modified = False
        self._closed = False
        self._error_at_line = {}
        self._is_tree_in_sync = True
        self._pub_nodes = None
コード例 #2
0
ファイル: profiler.py プロジェクト: bmerry/meqtrees-timba
    def __init__(self, parent, name):
        self._wtop = wtop = QWidget(parent)
        self._wtop_lo = wtop_lo = QVBoxLayout(self._wtop)
        wtop_lo.setContentsMargins(0, 0, 0, 0)
        wtop_lo.setSpacing(0)
        self._appgui = app_proxy_gui.appgui(parent)

        # find main window to associate our toolbar with
        self._toolbar = QToolBar("Profiler tools", wtop)
        wtop_lo.addWidget(self._toolbar)
        self._toolbar.setIconSize(QSize(16, 16))
        self._toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        ## COLLECT button
        self._qa_collect = self._toolbar.addAction(pixmaps.refresh.icon(),
                                                   "Collect",
                                                   self.collect_stats)
        self._qa_collect.setToolTip("Collect profiling stats from meqserver")

        #self._tb_collect = QToolButton(self._toolbar);
        #self._tb_collect.setIcon(pixmaps.refresh.icon());
        #self._tb_collect.setText("Collect");
        #self._tb_collect.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
        #self._tb_collect.setToolTip("Collect profiling stats from meqserver");
        #QObject.connect(self._tb_collect,SIGNAL("clicked()"),self.collect_stats);

        ## RESET button
        qa_reset = self._toolbar.addAction(pixmaps.grey_round_cross.icon(),
                                           "Reset", self.reset_stats)
        qa_reset.setToolTip("Reset meqserver's profiling stats")

        #tb_reset = QToolButton(self._toolbar);
        #tb_reset.setIcon(pixmaps.grey_round_cross.icon());
        #tb_reset.setText("Reset");
        #tb_reset.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
        #tb_reset.setToolTip("Reset meqserver's profiling stats");
        #QObject.connect(tb_reset,SIGNAL("clicked()"),self.reset_stats);

        ## label
        self._label = QLabel(self._toolbar)
        self._toolbar.addWidget(self._label)
        # self._toolbar.setStretchableWidget(self._label);
        self._label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self._label.setIndent(20)

        ## listview
        self._tw = QTreeWidget(wtop)
        wtop_lo.addWidget(self._tw)
        self._tw.setHeaderLabels([
            '',
            '',
            # profiling columns
            'Exec',
            '#',
            'avg',
            'Ch/x',
            '#',
            'avg',
            'Own',
            '#',
            'avg',
            # all cache columns
            'Rq all',
            'c/hit',
            'c/m',
            'c/-',
            '+C',
            '++C',
            # new cache columns
            'Rq new',
            'c/hit',
            'c/m',
            'c/-',
            '+C',
            '++C'
        ])
        self._tw.setRootIsDecorated(True)
        self._tw.setAllColumnsShowFocus(True)
        self._tw.setSortingEnabled(True)
        self._tw.header().setResizeMode(QHeaderView.ResizeToContents)
        self._tw.header().setMovable(False)
        self._tw.header().setDefaultAlignment(Qt.AlignRight)
        QObject.connect(self._tw, SIGNAL('itemExpanded(QTreeWidgetItem*)'),
                        self._expand_item)
        #    for col in range(1,self._tw.columns()):
        #      self._tw.setColumnAlignment(col,Qt.AlignRight);

        ## subscribe to nodelist changes
        meqds.subscribe_nodelist(self._process_nodelist)
コード例 #3
0
  def __init__ (self,parent,close_button=False,error_window=None):
    QFrame.__init__(self,parent);
    self._enabled = True;
    toplo = QVBoxLayout(self);
    toplo.setContentsMargins(0,0,0,0);
    toplo.setSpacing(0);

    self.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding);
    splitter = QSplitter(Qt.Vertical,self);
    toplo.addWidget(splitter);
    splitter.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding);
    splitter.setChildrenCollapsible(False);

    # figure out our app_gui parent
    self._appgui = app_proxy_gui.appgui(parent);

    # create an editor box
    editor_box = QFrame(splitter);
    lo = QVBoxLayout(editor_box);
    lo.setContentsMargins(0,0,0,0);
    lo.setSpacing(0);

    # find main window to associate our toolbar with
    mainwin = parent;
    while mainwin and not isinstance(mainwin,QMainWindow):
      mainwin = mainwin.parent();

    self._toolbar = QToolBar(mainwin or self);
    lo.addWidget(self._toolbar);
    self._toolbar.setIconSize(QSize(16,16));

    #### populate toolbar

    # Exec button and menu
    self._tb_tdlexec = QToolButton(self._toolbar);
    self._toolbar.addWidget(self._tb_tdlexec);
    self._tb_tdlexec.setIcon(pixmaps.gear.icon());
    self._tb_tdlexec.setText("Exec");
    self._tb_tdlexec.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
    self._tb_tdlexec.setToolTip("Accesses run-time options & jobs defined by this TDL script");
    self._tb_tdlexec.hide();

    jobs = self._tdlexec_menu = TDLOptionsDialog(self);
    jobs.setWindowTitle("TDL Jobs & Runtime Options");
    jobs.setWindowIcon(pixmaps.gear.icon());
    jobs.hide();
    QObject.connect(self._tb_tdlexec,SIGNAL("clicked()"),jobs.exec_);

    # save menu and button
    self._tb_save = QToolButton(self._toolbar);
    self._toolbar.addWidget(self._tb_save);
    self._tb_save.setIcon(pixmaps.file_save.icon());
    self._tb_save.setToolTip("Saves script. Click on the down-arrow for other options.");

    savemenu = QMenu(self);
    self._tb_save.setMenu(savemenu);
    self._tb_save.setPopupMode(QToolButton.MenuButtonPopup);
    self._tb_save._modified_color = QColor("yellow");
    qa_save = savemenu.addAction(pixmaps.file_save.icon(),"&Save script",self._save_file);
    qa_save.setShortcut(Qt.ALT+Qt.Key_S);
    QObject.connect(self._tb_save,SIGNAL("clicked()"),self._save_file);
    qa_save_as = savemenu.addAction(pixmaps.file_save.icon(),"Save script &as...",
                                     self.curry(self._save_file,save_as=True));
    qa_revert = self._qa_revert = savemenu.addAction("Revert to saved",self._revert_to_saved);

    # run menu and button

    self._qa_run = self._toolbar.addAction(pixmaps.blue_round_reload.icon(),
                              "&Save & reload",self._import_main_file);
    self._qa_run.setShortcut(Qt.ALT+Qt.Key_R);

    # Compile-time options and menu
    self._tb_opts = QToolButton(self._toolbar);
    self._toolbar.addWidget(self._tb_opts);
    self._tb_opts.setIcon(pixmaps.wrench.icon());
    self._tb_opts.setText("Options");
    self._tb_opts.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
    self._tb_opts.setToolTip("Accesses compile-time options for this TDL script");
    # self._tb_opts.hide();

    opts = self._options_menu = TDLOptionsDialog(self,ok_label="Compile",ok_icon=pixmaps.blue_round_reload);
    opts.setWindowTitle("TDL Compile-time Options");
    opts.setWindowIcon(pixmaps.wrench.icon());
    QObject.connect(opts,PYSIGNAL("accepted()"),self._compile_main_file);
    QObject.connect(TDLOptions.OptionObject,SIGNAL("mandatoryOptionsSet"),self.mark_mandatory_options_set);
    opts.hide();
    QObject.connect(self._tb_opts,SIGNAL("clicked()"),opts.show);
    # cross-connect the rereshProfiles() signals, so that dialogs can update each other's
    # profile menus
    QObject.connect(self._options_menu,PYSIGNAL("refreshProfiles()"),self._tdlexec_menu.refresh_profiles);
    QObject.connect(self._tdlexec_menu,PYSIGNAL("refreshProfiles()"),self._options_menu.refresh_profiles);

    self._toolbar.addSeparator();

    # cursor position indicator
    self._poslabel = QLabel(self._toolbar);
    #wa = QWidgetAction(self._toolbar);
    #wa.setDefaultWidget(self._poslabel);
    #self._toolbar.addAction(wa);
    #self._toolbar.addWidget(self._poslabel);
    self._toolbar.addWidget(self._poslabel);
    width = self._poslabel.fontMetrics().width("L:999 C:999");
    self._poslabel.setMinimumWidth(width);
    self._poslabel.setText("L:0 C:0");

    # filename indicator
    self._pathlabel = QLabel(self._toolbar);
    #wa = QWidgetAction(self._toolbar);
    #wa.setDefaultWidget(self._pathlabel);
    self._toolbar.addWidget(self._pathlabel);
    #self._toolbar.addAction(wa);
    self._pathlabel.show();
    self._pathlabel.setAlignment(Qt.AlignRight|Qt.AlignVCenter);
    self._pathlabel.setIndent(10);
    self._pathlabel.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Minimum);
    if close_button:
      if not isinstance(close_button,QIcon):
        close_button = pixmaps.remove.icon();
      self._qa_close = self._toolbar.addAction(close_button,"&Close file",self._file_closed);
      self._qa_close.setShortcut(Qt.ALT+Qt.Key_W);
    self._pathlabel.setText("(no file)");

    #### add editor window

    self._editor = editor = QTextEdit(editor_box);
    lo.addWidget(self._editor);
    editor.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding);
    editor.setAcceptRichText(False);
    editor.setLineWrapMode(QTextEdit.NoWrap);
    self._document = QTextDocument(self);
    editor.setDocument(self._document);
    QObject.connect(self._document,SIGNAL("modificationChanged(bool)"),self._text_modified);
    QObject.connect(self._editor,SIGNAL("cursorPositionChanged()"),self._display_cursor_position);
    # QObject.connect(self._editor,SIGNAL("textChanged()"),self._clear_transients);

    # add character formats for error display
    self._format_error = QTextCharFormat(self._editor.currentCharFormat());
    self._format_error.setBackground(QBrush(QColor("lightpink")));
    self._format_suberror = QTextCharFormat(self._editor.currentCharFormat());
    self._format_suberror.setBackground(QBrush(QColor("lightgrey")));
    self._format_current_error = QTextCharFormat(self._editor.currentCharFormat());
    self._format_current_error.setBackground(QBrush(QColor("orangered")));

    # add message window
    self._message_box = QFrame(editor_box);
    lo.addWidget(self._message_box);
    self._message_box.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred);
    self._message_box.setFrameStyle(QFrame.Panel+QFrame.Sunken);
    self._message_box.setLineWidth(2);
    mblo = QVBoxLayout(self._message_box);
    mblo.setContentsMargins(0,0,0,0);
    msgb1 = QHBoxLayout();
    mblo.addLayout(msgb1);
    msgb1.setContentsMargins(0,0,0,0);
    msgb1.setSpacing(0);
    self._message_icon = QToolButton(self._message_box);
    msgb1.addWidget(self._message_icon);
    self._message = QLabel(self._message_box);
    msgb1.addWidget(self._message);
    self._message.setTextFormat(Qt.RichText);
    self._message.setWordWrap(True);
    self._message.setMargin(0);
    self._message.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred);
    # self._message_icon.setAlignment(Qt.AlignTop);
    # self._message_icon.setMargin(4);
    self._message_icon.setAutoRaise(True);
    self._message_icon.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed);
    QObject.connect(self._message_icon,SIGNAL("clicked()"),self.clear_message);
    self._message_icon.setToolTip("Click here to clear the message");
    self._message_widgets = [];
    self._message_transient = False;

    # figure out if we already have an error box to attach to
    self._error_window = error_window or getattr(parent,'_tdlgui_error_window',None);
    if self._error_window:
      #self._resize_errwin = False;
      pass;
    else:
      # otherwise create an error floater
      self._error_window = TDLErrorFloat(parent);
      setattr(parent,'_tdlgui_error_window',self._error_window);
      # self._resize_errwin = True;
    QObject.connect(self._error_window,PYSIGNAL("hasErrors()"),self._reset_errors);
    QObject.connect(self._error_window,PYSIGNAL("showError()"),self.show_error);

    # set filename
    self._filename = None;       # "official" path of file (None if new script not yet saved)
    self._mainfile = None;       # if not None, then we're "slaved" to a main file (see below)
    self._file_disktime = None;  # modtime on disk when file was loaded
    self._basename = None;
    self._modified = False;
    self._closed = False;
    self._error_at_line = {};
    self._is_tree_in_sync = True;
    self._pub_nodes = None;
コード例 #4
0
ファイル: profiler.py プロジェクト: gijzelaerr/meqtrees-timba
  def __init__ (self,parent,name):
    self._wtop = wtop = QWidget(parent);
    self._wtop_lo = wtop_lo = QVBoxLayout(self._wtop);
    wtop_lo.setContentsMargins(0,0,0,0);
    wtop_lo.setSpacing(0);
    self._appgui = app_proxy_gui.appgui(parent);
    
    # find main window to associate our toolbar with
    self._toolbar = QToolBar("Profiler tools",wtop);
    wtop_lo.addWidget(self._toolbar);
    self._toolbar.setIconSize(QSize(16,16));
    self._toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
    
    ## COLLECT button
    self._qa_collect = self._toolbar.addAction(pixmaps.refresh.icon(),"Collect",self.collect_stats);
    self._qa_collect.setToolTip("Collect profiling stats from meqserver");

    #self._tb_collect = QToolButton(self._toolbar);
    #self._tb_collect.setIcon(pixmaps.refresh.icon());
    #self._tb_collect.setText("Collect");
    #self._tb_collect.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
    #self._tb_collect.setToolTip("Collect profiling stats from meqserver");
    #QObject.connect(self._tb_collect,SIGNAL("clicked()"),self.collect_stats);
   
    ## RESET button
    qa_reset = self._toolbar.addAction(pixmaps.grey_round_cross.icon(),"Reset",self.reset_stats);
    qa_reset.setToolTip("Reset meqserver's profiling stats");

    #tb_reset = QToolButton(self._toolbar);
    #tb_reset.setIcon(pixmaps.grey_round_cross.icon());
    #tb_reset.setText("Reset");
    #tb_reset.setToolButtonStyle(Qt.ToolButtonTextBesideIcon);
    #tb_reset.setToolTip("Reset meqserver's profiling stats");
    #QObject.connect(tb_reset,SIGNAL("clicked()"),self.reset_stats);
    
    ## label     
    self._label = QLabel(self._toolbar);
    self._toolbar.addWidget(self._label);
    # self._toolbar.setStretchableWidget(self._label);
    self._label.setAlignment(Qt.AlignRight|Qt.AlignVCenter);
    self._label.setIndent(20);
    
    ## listview
    self._tw = QTreeWidget(wtop);
    wtop_lo.addWidget(self._tw);
    self._tw.setHeaderLabels(['','',
    # profiling columns
         'Exec',
         '#',
         'avg',
         'Ch/x',
         '#',
         'avg',
         'Own',
         '#',
         'avg',
    # all cache columns
         'Rq all',
         'c/hit',
         'c/m',
         'c/-',
         '+C',
         '++C',
    # new cache columns
         'Rq new',
         'c/hit',
         'c/m',
         'c/-',
         '+C',
         '++C'
      ]);
    self._tw.setRootIsDecorated(True);
    self._tw.setAllColumnsShowFocus(True);
    self._tw.setSortingEnabled(True);
    self._tw.header().setResizeMode(QHeaderView.ResizeToContents);
    self._tw.header().setMovable(False);
    self._tw.header().setDefaultAlignment(Qt.AlignRight);
    QObject.connect(self._tw,SIGNAL('itemExpanded(QTreeWidgetItem*)'),self._expand_item);
#    for col in range(1,self._tw.columns()):
#      self._tw.setColumnAlignment(col,Qt.AlignRight);
    
    ## subscribe to nodelist changes
    meqds.subscribe_nodelist(self._process_nodelist);