def show_info(self):
        """
        displays the doc string of the selected element
        """
        sender = self.sender()
        tree = sender.parent()
        index = tree.selectedIndexes()
        info = ''
        if index != []:
            index = index[0]
            name = str(index.model().itemFromIndex(index).text())
            self.selected_element_name = name



            if name in self.elements_old:
                info = self.elements_old[name].__doc__

            #TODO: check if this is portable
            elif name in self.elements_from_file:
                class_name = self.elements_from_file[name]['class']
                if 'filepath' in self.elements_from_file[name]:
                    filepath = self.elements_from_file[name]['filepath']
                if 'info' in self.elements_from_file[name]:
                    info = self.elements_from_file[name]['info']
                #
                # path_to_src_scripts = filepath[:filepath.find('\\pylabcontrol\\scripts\\')]
                # module_name = path_to_src_scripts[path_to_src_scripts.rfind('\\')+1:]
                # module = __import__('{:s}.pylabcontrol.{:s}'.format(module_name, self.elements_type), fromlist=[class_name])
                # info = getattr(module, class_name).__doc__



            if info is None:
                info = name

            if tree == self.tree_infile:
                self.lbl_info.setText(info)
                self.tree_loaded.clearSelection()

            elif tree == self.tree_loaded:
                self.lbl_info.setText(info)
                self.tree_infile.clearSelection()
def show_info ( self ) : sender = self . sender ( ) tree = sender . parent ( ) index = tree . selectedIndexes ( ) info = '' if index != [ ] : index = index [ 0 ] name = str ( index . model ( ) . itemFromIndex ( index ) . text ( ) ) self . selected_element_name = name if name in self . elements_old : info = self . elements_old [ name ] . __doc__ elif name in self . elements_from_file : class_name = self . elements_from_file [ name ] [ 'class' ] if 'filepath' in self . elements_from_file [ name ] : filepath = self . elements_from_file [ name ] [ 'filepath' ] if 'info' in self . elements_from_file [ name ] : info = self . elements_from_file [ name ] [ 'info' ] if info is None : info = name if tree == self . tree_infile : self . lbl_info . setText ( info ) self . tree_loaded . clearSelection ( ) elif tree == self . tree_loaded : self . lbl_info . setText ( info ) self . tree_infile . clearSelection ( )
displays the doc string of the selected element