コード例 #1
0
    def create_or_find_figure(self,title=None,subplots=None,window_name = None):
        """Create a matplotlib figure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf

        # catch any background threads trying to call display functions.
        assert not self.__in_background 

        if title==None:
            title=self.__module.module_name
            
        if window_name == None:
            window_name = cpf.window_name(self.__module)
            
        if self.__create_new_window:
            figure = CPFigureFrame(self, 
                                   title=title,
                                   name = window_name,
                                   subplots = subplots)
        else:
            figure = cpf.create_or_find(self.__frame, title = title, 
                                        name = window_name, 
                                        subplots = subplots)
        if not figure in self.__windows_used:
            self.__windows_used.append(figure)
        return figure
コード例 #2
0
    def get_module_figure(self, module, image_set_number, parent=None):
        """Create a CPFigure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf
        import cellprofiler.measurements as cpmeas

        # catch any background threads trying to call display functions.
        assert not self.__in_background
        window_name = cpf.window_name(module)
        if self.measurements.has_feature(cpmeas.EXPERIMENT,
                                         cpmeas.M_GROUPING_TAGS):
            group_number = self.measurements[cpmeas.IMAGE, cpmeas.GROUP_NUMBER,
                                             image_set_number]
            group_index = self.measurements[cpmeas.IMAGE, cpmeas.GROUP_INDEX,
                                            image_set_number]
            title = "%s #%d, image cycle #%d, group #%d, group index #%d" % (
                module.module_name, module.module_num, image_set_number,
                group_number, group_index)
        else:
            title = "%s #%d, image cycle #%d" % (
                module.module_name, module.module_num, image_set_number)

        if self.__create_new_window:
            figure = cpf.CPFigureFrame(parent or self.__frame,
                                       name=window_name,
                                       title=title)
        else:
            figure = cpf.create_or_find(parent or self.__frame,
                                        name=window_name,
                                        title=title)

        if not figure in self.__windows_used:
            self.__windows_used.append(figure)

        return figure
コード例 #3
0
    def create_or_find_figure(self,
                              title=None,
                              subplots=None,
                              window_name=None):
        """Create a matplotlib figure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf

        # catch any background threads trying to call display functions.
        assert not self.__in_background

        if title == None:
            title = self.__module.module_name

        if window_name == None:
            window_name = cpf.window_name(self.__module)

        if self.__create_new_window:
            figure = cpf.CPFigureFrame(self,
                                       title=title,
                                       name=window_name,
                                       subplots=subplots)
        else:
            figure = cpf.create_or_find(self.__frame,
                                        title=title,
                                        name=window_name,
                                        subplots=subplots)
        if not figure in self.__windows_used:
            self.__windows_used.append(figure)
        return figure
コード例 #4
0
ファイル: workspace.py プロジェクト: anntzer/CellProfiler
    def get_module_figure(self, module, image_set_number, parent=None):
        """Create a CPFigure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf

        # catch any background threads trying to call display functions.
        assert not self.__in_background

        window_name = cpf.window_name(module)
        title = "%s #%d, image cycle #%d" % (module.module_name,
                                             module.module_num,
                                             image_set_number)

        if self.__create_new_window:
            figure = cpf.CPFigureFrame(parent or self.__frame,
                                       name=window_name,
                                       title=title)
        else:
            figure = cpf.create_or_find(parent or self.__frame,
                                        name=window_name,
                                        title=title)

        if not figure in self.__windows_used:
            self.__windows_used.append(figure)

        return figure
コード例 #5
0
    def __on_list_dclick(self, event):
        if sys.platform.startswith("win"):
            item, hit_code, subitem = self.list_ctrl.HitTestSubItem(
                event.Position)
        else:
            # Mac's HitTestSubItem does not work. Sorry.
            #
            item, hit_code = self.list_ctrl.HitTest(event.Position)
            widths = [self.list_ctrl.GetColumnWidth(i) for i in range(4)]
            start = 0
            for subitem in range(4):
                if event.Position[0] < start + widths[subitem]:
                    break
                start += widths[subitem]

        if (item >= 0 and item < self.list_ctrl.ItemCount
                and (hit_code & wx.LIST_HITTEST_ONITEM)
                and subitem == MODULE_NAME_COLUMN):
            module = self.__pipeline.modules()[item]
            name = window_name(module)
            figure = self.__panel.TopLevelParent.FindWindowByName(name)
            if figure is not None:
                figure.Show(0)
                figure.Show(1)
                figure.SetFocus()
コード例 #6
0
ファイル: workspace.py プロジェクト: 0x00B1/CellProfiler
    def get_module_figure(self, module, image_set_number, parent=None):
        """Create a CPFigure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf
        import cellprofiler.measurements as cpmeas

        # catch any background threads trying to call display functions.
        assert not self.__in_background
        window_name = cpf.window_name(module)
        if self.measurements.has_feature(cpmeas.EXPERIMENT,
                                         cpmeas.M_GROUPING_TAGS):
            group_number = self.measurements[
                cpmeas.IMAGE, cpmeas.GROUP_NUMBER, image_set_number]
            group_index = self.measurements[
                cpmeas.IMAGE, cpmeas.GROUP_INDEX, image_set_number]
            title = "%s #%d, image cycle #%d, group #%d, group index #%d" % (
                module.module_name, module.module_num, image_set_number,
                group_number, group_index)
        else:
            title = "%s #%d, image cycle #%d" % (module.module_name,
                                                 module.module_num,
                                                 image_set_number)

        if self.__create_new_window:
            figure = cpf.CPFigureFrame(parent or self.__frame,
                                       name=window_name,
                                       title=title)
        else:
            figure = cpf.create_or_find(parent or self.__frame,
                                        name=window_name,
                                        title=title)

        if not figure in self.__windows_used:
            self.__windows_used.append(figure)

        return figure
コード例 #7
0
 def __on_list_left_down(self, event):
     if sys.platform.startswith("win"):
         item, hit_code, subitem = self.list_ctrl.HitTestSubItem(
             event.Position)
     else:
         # Mac's HitTestSubItem does not work. Sorry.
         #
         item, hit_code = self.list_ctrl.HitTest(event.Position)
         widths = [self.list_ctrl.GetColumnWidth(i) for i in range(4)]
         start = 0
         for subitem in range(4):
             if event.Position[0] < start + widths[subitem]:
                 break
             start += widths[subitem]
     if (item >= 0 and item < self.list_ctrl.ItemCount
             and (hit_code & wx.LIST_HITTEST_ONITEM)):
         module = self.__pipeline.modules()[item]
         if subitem == PAUSE_COLUMN and self.__debug_mode:
             module.wants_pause = not module.wants_pause
             pause_img = get_image_index(
                 PAUSE if module.wants_pause else GO)
             self.list_ctrl.SetItemImage(item, pause_img)
         elif subitem == EYE_COLUMN:
             module.show_window = not module.show_window
             eye_img = get_image_index(
                 EYE if module.show_window else CLOSED_EYE)
             self.set_subitem_image(item, EYE_COLUMN, eye_img)
             name = window_name(module)
             figure = self.__panel.TopLevelParent.FindWindowByName(name)
             if figure is not None:
                 figure.Close()
         else:
             if self.list_ctrl.IsSelected(item):
                 self.start_drag_operation(event)
             else:
                 event.Skip()
     else:
         event.Skip()
コード例 #8
0
 def __on_list_left_down(self, event):
     if sys.platform.startswith("win"):
         item, hit_code, subitem = self.list_ctrl.HitTestSubItem(event.Position)
     else:
         # Mac's HitTestSubItem does not work. Sorry.
         #
         item, hit_code = self.list_ctrl.HitTest(event.Position)
         widths = [self.list_ctrl.GetColumnWidth(i) for i in range(4)]
         start = 0
         for subitem in range(4):
             if event.Position[0] < start + widths[subitem]:
                 break
             start += widths[subitem]
     if (item >= 0 and item < self.list_ctrl.ItemCount and
         (hit_code & wx.LIST_HITTEST_ONITEM)):
         module = self.__pipeline.modules()[item]
         if subitem == PAUSE_COLUMN and self.__debug_mode:
             module.wants_pause = not module.wants_pause
             pause_img = get_image_index(PAUSE if module.wants_pause
                                         else GO)
             self.list_ctrl.SetItemImage(item, pause_img)
         elif subitem == EYE_COLUMN:
             module.show_window = not module.show_window
             eye_img = get_image_index(EYE if module.show_window
                                       else CLOSED_EYE)
             self.set_subitem_image(item, EYE_COLUMN, eye_img)
             name = window_name(module)
             figure = self.__panel.TopLevelParent.FindWindowByName(name)
             if figure is not None:
                 figure.Close()
         else:
             if self.list_ctrl.IsSelected(item):
                 self.start_drag_operation(event)
             else:
                 event.Skip()
     else:
         event.Skip()
コード例 #9
0
ファイル: workspace.py プロジェクト: manerotoni/CellProfiler
    def get_module_figure(self, module, image_set_number, parent=None):
        """Create a CPFigure window or find one already created"""
        import cellprofiler.gui.cpfigure as cpf

        # catch any background threads trying to call display functions.
        assert not self.__in_background

        window_name = cpf.window_name(module)
        title = "%s #%d, image cycle #%d" % (
            module.module_name, module.module_num, image_set_number)

        if self.__create_new_window:
            figure = cpf.CPFigureFrame(parent or self.__frame,
                                       name=window_name,
                                       title=title)
        else:
            figure = cpf.create_or_find(parent or self.__frame,
                                        name=window_name,
                                        title=title)

        if not figure in self.__windows_used:
            self.__windows_used.append(figure)

        return figure
コード例 #10
0
 def __on_list_dclick(self, event):
     if sys.platform.startswith("win"):
         item, hit_code, subitem = self.list_ctrl.HitTestSubItem(event.Position)
     else:
         # Mac's HitTestSubItem does not work. Sorry.
         #
         item, hit_code = self.list_ctrl.HitTest(event.Position)
         widths = [self.list_ctrl.GetColumnWidth(i) for i in range(4)]
         start = 0
         for subitem in range(4):
             if event.Position[0] < start + widths[subitem]:
                 break
             start += widths[subitem]
     
     if (item >= 0 and item < self.list_ctrl.ItemCount and
         (hit_code & wx.LIST_HITTEST_ONITEM) and 
         subitem == MODULE_NAME_COLUMN):
         module = self.__pipeline.modules()[item]
         name = window_name(module)
         figure = self.__panel.TopLevelParent.FindWindowByName(name)
         if figure is not None:
             figure.Show(0)
             figure.Show(1)
             figure.SetFocus()