当前位置: 首页>>代码示例>>Python>>正文


Python pub.sendMessage函数代码示例

本文整理汇总了Python中wx.lib.pubsub.pub.sendMessage函数的典型用法代码示例。如果您正苦于以下问题:Python sendMessage函数的具体用法?Python sendMessage怎么用?Python sendMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LoadParamObj

 def LoadParamObj(self, pubsub_evt):
     coil_orient, self.coil_axis = self.dialog.GetValue
     self.showObj.SetValue(True)
     self.angle_tracking()
     Publisher.sendMessage('Track Coil Angle', (self.coil_axis,
                                                self.ap_axis))
     Publisher.sendMessage('Change Init Coil Angle', coil_orient)
开发者ID:vcuziol,项目名称:invesalius3,代码行数:7,代码来源:task_navigator.py

示例2: OnSlideChanging

 def OnSlideChanging(self, evt):
     thresh_min = self.gradient.GetMinValue()
     thresh_max = self.gradient.GetMaxValue()
     Publisher.sendMessage('Changing threshold values',
                                 (thresh_min, thresh_max))
     session = ses.Session()
     session.ChangeProject()
开发者ID:151706061,项目名称:invesalius3,代码行数:7,代码来源:task_slice.py

示例3: OnRightClick

 def OnRightClick(self, event = None):
     """
     
         Actions triggered by right click on list item.
         
         Parameters:
             event    -    wx.Event
     
     """
     # show menu
     if event.GetEventType() == wx.EVT_RIGHT_DOWN.evtType[0]:
         if self.list.HitTest(event.GetPosition())[0]>-1:
             # right click on a history item => handled by specific event
             event.Skip()
             return
         else:
             # right click in list but not on list entry => only Load available 
             menu = wx.Menu()
             itm = menu.Append(wx.NewId(), "&Load scan")
             self.Bind(wx.EVT_MENU, self.OnLoad, id=itm.Id)
             self.PopupMenu(menu)
             return
     # right click on list item
     menu = wx.Menu()
     itm = menu.Append(wx.NewId(), "&Load scan")
     self.Bind(wx.EVT_MENU, self.OnLoad, id=itm.Id)
     if event.GetIndex()>-1:
         arr = self.list.GetItemPyData(event.GetIndex())
         # create menu entries for operations on item
         itm = menu.Append(wx.NewId(), "&Rename")
         self.Bind(wx.EVT_MENU, lambda x: self.list.EditLabel(event.GetIndex()), id=itm.Id)
         itm = menu.Append(wx.NewId(), "&Delete")
         self.Bind(wx.EVT_MENU, lambda x: self.Delete(event.GetIndex()), id=itm.Id)
         itm = menu.Append(wx.NewId(), "&Save as...")
         self.Bind(wx.EVT_MENU, lambda x: self.SaveAs(event.GetIndex()), id=itm.Id)
         # if array has a xml image of event tree, propose reload
         if hasattr(arr,'xml'):
             itm = menu.Append(wx.NewId(),"Reload event tree")
             self.Bind(wx.EVT_MENU, lambda x: pub.sendMessage("history.reload_events", string=arr.xml), id=itm.Id)
         # specific menu entries for 1D plot
         if len(arr.shape) == 1:
             itm = menu.Append(wx.NewId(), "Change c&olor")
             self.Bind(wx.EVT_MENU, lambda x: self.ChangeColour(event.GetIndex()), id=itm.Id)
             if arr.color!=None:
                 itm = menu.Append(wx.NewId(), "Reset c&olor")
                 self.Bind(wx.EVT_MENU, lambda x: self.ResetColour(event.GetIndex()), id=itm.Id)
             if not(hasattr(self,"window")):
                 pub.sendMessage("request_top_window")
             if not(self.window.is_scanning) or event.GetIndex()>0:
                 if not(hasattr(self,"canvas")):
                     pub.sendMessage("request_canvas")
                 if self.list.IsReference(event.GetIndex()):
                     itm = menu.Append(wx.NewId(), "&Clear reference")
                     self.Bind(wx.EVT_MENU, self.ClearReference, id=itm.Id)
                 if self.canvas.CurrentPage!=None:
                     if self.canvas.CurrentPage.is_filter:
                         itm = menu.Append(wx.NewId(), "S&et as reference")
                         self.Bind(wx.EVT_MENU, lambda x: self.SetReference(event.GetIndex()), id=itm.Id)
         
     self.PopupMenu(menu)
开发者ID:vpaeder,项目名称:terapy,代码行数:60,代码来源:history.py

示例4: onOpenProcessed

    def onOpenProcessed(self,evt):
        """Function for meuitem open processed
        Read the *.npz files in a directory and converts to a video"""
        dlg = wx.DirDialog(self,"Choose a Directory")
        
        if dlg.ShowModal() == wx.ID_OK:
            dirpath = dlg.GetPath()
            procVid = ProcessedVideo.ProcessedVideo(path=dirpath)
            self.dirname = dirpath
            if self.procFilename:
                pathbits = dirpath.split(os.sep)
                self.vidid = pathbits[-1]
                self.testid = pathbits[-2]
                self.subjectid = pathbits[-3]
                #fname,ext = os.path.splitext(filename)
                #self.filename = fname
            
            newVid = AOVideo.AOVideo(frameheight = procVid.frameheight,
                             framewidth = procVid.framewidth)
            for frame in procVid:
                newVid.addFrame(frame)
            self._video = newVid

            self._video.currentframeidx = 0
            self.videoControls.maxval = self._video.framecount
            self.videoControls.curval = self._video.currentframeidx   
            pub.sendMessage('max_frame_count',data=self._video.framecount)
            self.image.reset()
            self.UpdateDisplay()
开发者ID:tomwright01,项目名称:py_AO_Registration,代码行数:29,代码来源:AORegistration.py

示例5: StartImportPanel

    def StartImportPanel(self, path):

        # retrieve DICOM files splited into groups
        reader = dcm.ProgressDicomReader()
        reader.SetWindowEvent(self.frame)
        reader.SetDirectoryPath(path)
        Publisher.sendMessage('End busy cursor')
开发者ID:biomaglab,项目名称:invesalius3,代码行数:7,代码来源:control.py

示例6: Buttons

 def Buttons(self, evt):
     id = evt.GetId()
     x, y, z = self.a
     if id == PR1:
         self.aux_plh_ref1 = 0
         self.coord1b = self.Coordinates()
         coord = self.coord1b
     elif id == PR2:
         self.aux_plh_ref2 = 0
         self.coord2b = self.Coordinates()
         coord = self.coord2b
     elif id == PR3:
         self.aux_plh_ref3 = 0
         self.coord3b = self.Coordinates()
         coord = self.coord3b
     elif id == GetPoint:
         x, y, z = self.a
         self.numCtrl1g.SetValue(x)
         self.numCtrl2g.SetValue(y)
         self.numCtrl3g.SetValue(z)
         info = self.a, self.flagpoint
         self.SaveCoordinates(info)
         self.flagpoint = 1 
     elif id == Corregistration and self.aux_img_ref1 == 1 and self.aux_img_ref2 == 1 and self.aux_img_ref3 == 1:
         print "Coordenadas Imagem: ", self.coord1a, self.coord2a, self.coord3a
         print "Coordenadas Polhemus: ", self.coord1b, self.coord2b, self.coord3b
         
         self.M, self.q1, self.Minv = db.Bases(self.coord1a, self.coord2a, self.coord3a).Basecreation()
         self.N, self.q2, self.Ninv = db.Bases(self.coord1b, self.coord2b, self.coord3b).Basecreation()
             
     if self.aux_plh_ref1 == 0 or self.aux_plh_ref2 == 0 or self.aux_plh_ref3 == 0:
         Publisher.sendMessage('Update plh position', coord)         
开发者ID:151706061,项目名称:invesalius3,代码行数:32,代码来源:task_navigator.py

示例7: OnInsertAngularMeasurePoint

    def OnInsertAngularMeasurePoint(self, obj, evt):
        x,y = self.interactor.GetEventPosition()
        self.measure_picker.Pick(x, y, 0, self.ren)
        x, y, z = self.measure_picker.GetPickPosition()

        proj = prj.Project()
        radius = min(proj.spacing) * PROP_MEASURE
        if self.measure_picker.GetActor(): 
            # if not self.measures or self.measures[-1].IsComplete():
                # m = measures.AngularMeasure(self.ren)
                # m.AddPoint(x, y, z)
                # self.measures.append(m)
            # else:
                # m = self.measures[-1]
                # m.AddPoint(x, y, z)
                # if m.IsComplete():
                    # index = len(self.measures) - 1
                    # name = "M"
                    # colour = m.colour
                    # type_ = _("Angular")
                    # location = u"3D"
                    # value = u"%.2f˚"% m.GetValue()
                    # msg =  'Update measurement info in GUI',
                    # Publisher.sendMessage(msg,
                                               # (index, name, colour,
                                                # type_, location,
                                                # value))
            Publisher.sendMessage("Add measurement point",
                    ((x, y,z), const.ANGULAR, const.SURFACE, radius))
            self.interactor.Render()
开发者ID:151706061,项目名称:invesalius3,代码行数:30,代码来源:viewer_volume.py

示例8: _gotChooserItems

  def _gotChooserItems(self, l):
    self.runChooserItems = l
    items = []
    found = False

    for run in self.runChooserItems:
      items.append(run['nice_name'])
      if self.runChooserSelected and self.runChooserSelected['id'] == run['id']:
        found = True

    self.runChooser.Freeze()
    self.runChooser.Clear()
    self.runChooser.AppendItems(items)
    self.runChooser.Thaw()

    if items == []:
      self.runChooser.SetSelection(wx.NOT_FOUND)
      self.runChooserSelected = None
    elif not found:
      self.runChooser.SetSelection(0)
      self.runChooserSelected = self.runChooserItems[0]
    else:
      for i, e in zip(range(len(self.runChooserItems)), self.runChooserItems):
        if e['id'] == self.runChooserSelected['id']:
          self.runChooser.SetSelection(i)

    pub.sendMessage("run_selection_changed", run = self.runChooserSelected)
开发者ID:kuhout,项目名称:agi,代码行数:27,代码来源:controllers.py

示例9: _onView

    def _onView(self, view):
        """
        Called when the current view changes
        """

        if not view:
            return

        # import sys
        # print sys.getrefcount(self)

        # hide/show the stream panels which are compatible with the view
        allowed_classes = view.stream_classes
        for e in self._stream_bar.stream_panels:
            e.Show(isinstance(e.stream, allowed_classes))
        # self.Refresh()
        self._stream_bar._fit_streams()

        # update the "visible" icon of each stream panel to match the list
        # of streams in the view
        visible_streams = view.getStreams()

        for e in self._stream_bar.stream_panels:
            e.set_visible(e.stream in visible_streams)

        logging.debug("Sending stream.ctrl message")
        pub.sendMessage('stream.ctrl',
                        streams_present=True,
                        streams_visible=self._has_visible_streams(),
                        tab=self._tab_data_model)
开发者ID:arijitxx,项目名称:odemis,代码行数:30,代码来源:streams.py

示例10: OnFoldPressCaption

    def OnFoldPressCaption(self, evt):
        id = evt.GetTag().GetId()
        closed = evt.GetFoldStatus()

        if self.__id_editor == id:
            if closed:
                Publisher.sendMessage('Disable style', style=const.SLICE_STATE_EDITOR)
                self.last_style = None
            else:
                Publisher.sendMessage('Enable style', style=const.SLICE_STATE_EDITOR)
                self.last_style = const.SLICE_STATE_EDITOR
        elif self.__id_watershed == id:
            if closed:
                Publisher.sendMessage('Disable style', style=const.SLICE_STATE_WATERSHED)
                self.last_style = None
            else:
                Publisher.sendMessage('Enable style', style=const.SLICE_STATE_WATERSHED)
                #  Publisher.sendMessage('Show help message', 'Mark the object and the background')
                self.last_style = const.SLICE_STATE_WATERSHED
        else:
            Publisher.sendMessage('Disable style', style=const.SLICE_STATE_EDITOR)
            self.last_style = None

        evt.Skip()
        wx.CallAfter(self.ResizeFPB)
开发者ID:paulojamorim,项目名称:invesalius3,代码行数:25,代码来源:task_slice.py

示例11: set_date_bound

 def set_date_bound(self, start, end):
       print "start:", start, end
       if start > self.maxStart:
           self.maxStart = start
       if end < self.maxEnd:
           self.maxEnd = end
       Publisher.sendMessage(("resetdate"), startDate=self.maxStart, endDate=self.maxEnd)
开发者ID:RussNelson,项目名称:ODMToolsPython,代码行数:7,代码来源:plotTimeSeries.py

示例12: OnLinkNewMask

    def OnLinkNewMask(self, evt=None):

        try:
            evt.data
            evt = None
        except:
            pass

        dialog = dlg.NewMask()

        try:
            if dialog.ShowModal() == wx.ID_OK:
                ok = 1
            else:
                ok = 0
        except(wx._core.PyAssertionError): #TODO FIX: win64
            ok = 1

        if ok:
            mask_name, thresh, colour = dialog.GetValue()
            if mask_name:
                Publisher.sendMessage('Create new mask',
                                      mask_name=mask_name,
                                      thresh=thresh,
                                      colour=colour)
        dialog.Destroy()
开发者ID:paulojamorim,项目名称:invesalius3,代码行数:26,代码来源:task_slice.py

示例13: OnOpen

 def OnOpen(self, path):
     fileName, fileExtension = os.path.splitext(path)
     self.filename = fileName+fileExtension
     pub.sendMessage("panelListener2", message= fileName)
     if fileExtension == '.xml':
         self.loaded = 1
         self.parseXMLDocument(path)
开发者ID:vdury,项目名称:SoundIndex,代码行数:7,代码来源:text_editor_2.py

示例14: OnEnablePlugin

    def OnEnablePlugin(self, evt=None):
        """Publish the enabled/disabled state of the plugin."""

        item = self.tcPlugins.GetSelection()
        n = self.tcPlugins.GetItemData(item)
        plugin = self.plugins[n]
        p = plugin['plugin']

        # Set the checkbox to the appropriate state if the event
        # comes from the treeview
        if (evt.EventType == wx.EVT_TREE_ITEM_ACTIVATED.typeId):
            self.checkEnabled.SetValue(not self.checkEnabled.IsChecked())

        if self.checkEnabled.IsChecked():
            self.tcPlugins.SetItemImage(item, 1)
            self.tcPlugins.SetItemTextColour(item, wx.BLACK)
            self.pluginsDisabled.remove(p.__name__)
            logger.debug("%s enabled", p.__name__)
        else:
            self.tcPlugins.SetItemImage(item, 2)
            self.tcPlugins.SetItemTextColour(item, wx.Colour(169, 169, 169))
            self.pluginsDisabled.add(p.__name__)
            logger.debug("%s disabled", p.__name__)

        pub.sendMessage('preferences.updated.value',
                msg={'general.plugins.disabled_list': list(self.pluginsDisabled)})
开发者ID:bastula,项目名称:dicompyler,代码行数:26,代码来源:plugin.py

示例15: removeStream

    def removeStream(self, stream):
        """
        Removes the given stream.
        stream (Stream): the stream to remove
        Note: the stream panel is to be destroyed separately via the stream_bar
        It's ok to call if the stream has already been removed
        """
        # don't schedule any more
        self._unscheduleStream(stream)

        # Remove from the views
        for v in self._tab_data_model.views.value:
            if hasattr(v, "removeStream"):
                v.removeStream(stream)

        try:
            self._tab_data_model.streams.value.remove(stream)
        except ValueError:
            logging.warn("Stream not found, so not removed")

        logging.debug("Sending stream.ctrl.removed message")
        pub.sendMessage('stream.ctrl.removed',
                        streams_present=self._has_streams(),
                        streams_visible=self._has_visible_streams(),
                        tab=self._tab_data_model)
开发者ID:arijitxx,项目名称:odemis,代码行数:25,代码来源:streams.py


注:本文中的wx.lib.pubsub.pub.sendMessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。