• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pub.sendMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: displayData

   def displayData(self):
       #rint'panel_student_bookings : displayData'
       sql = "SELECT s.id , c.name, s.name , name.reg_status \
                FROM students s \
                JOIN courses c ON s.register_course_id = c.id \
               WHERE s.register_schYr = %d" % gVar.schYr
       
       school_id = 0
       if gVar.school == "CG":            school_id = 1
       if gVar.school == "SD":            school_id = 2    
       if gVar.school == "SMP":           school_id = 3    
       if gVar.school == "SMA":           school_id = 4     
 
       if school_id:
           #rint"School"
           sqlSch = " AND c.school_id = %d" % school_id
           sql = "%s%s" % (sql, sqlSch)
           
       #sql = "%s%s" % (sql, " ORDER BY cSiswa.Kelas, cSiswa.Nama"  )
 
       results = fetch.DATA(sql)
       
       gVar.msg = " %d records found" % len(results)
       pub.sendMessage("change.statusbar")    
   
       self.vListBookings.SetItemMap(results)
       self.Layout()
开发者ID:ckSchool,项目名称:bucky,代码行数:27,代码来源:student_bookings.py


示例17: clear

    def clear(self):
        """
        Remove all the streams (from the model and the GUI)
        """
        # We could go for each stream panel, and call removeStream(), but it's
        # as simple to reset all the lists

        # clear the graphical part
        while self._stream_bar.stream_panels:
            spanel = self._stream_bar.stream_panels[0]
            self._stream_bar.remove_stream_panel(spanel)

        # clear the interface model
        # (should handle cases where a new stream is added simultaneously)
        while self._tab_data_model.streams.value:
            stream = self._tab_data_model.streams.value.pop()
            self._unscheduleStream(stream)

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

        if self._has_streams() or self._has_visible_streams():
            logging.warning("Failed to remove all streams")

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


示例18: updatePrice

 def updatePrice(self, message):
     if self.bdmReady:
         self.lock.acquire()
         bond = message.data.name
         idx = (self.th.positionsByISINBook['Bond'] == bond)
         if idx.sum()>0:
             price = message.data['MID']
             self.th.positionsByISINBook.loc[idx,'PriceT'] = price
             self.th.positionsByISINBook.loc[idx,'SODPnL'] = self.th.positionsByISINBook.loc[idx,'SOD_Pos'] * self.bdm.df.loc[bond,'PRINCIPAL_FACTOR'] * (price - self.th.positionsByISINBook.loc[idx,'PriceY'])/100.
             self.th.positionsByISINBook.loc[idx,'SODPnL'].fillna(0, inplace=True)
             fx = ccy.at[bonds.at[bond,'CRNCY'],'2016']
             if bond in self.new_trades['Bond'].values:
                 for (k,grp) in self.positionDeltas:
                     isin = k[1]
                     try:
                         if allisins[isin] == bond:#grp['Qty'].sum()!=0 
                             idx = (self.new_trades['ISIN'] == isin) & (self.new_trades['Book'] == k[0])
                             self.new_trades.loc[idx,'TradePnL'] = self.new_trades.loc[idx,'Qty']*(price-self.new_trades.loc[idx,'Price'])/100.
                             self.th.positionsByISINBook.at[k[0]+'-'+k[1],'TradePnL'] = self.th.positionsByISINBook.at[k[0]+'-'+k[1],'PRINCIPAL_FACTOR'] * self.new_trades.loc[idx,'TradePnL'].sum()
                     except:
                         #bond is dummy
                         pass
             ########
             bondlines = (self.th.positionsByISINBook['Bond'] == bond)
             self.th.positionsByISINBook.loc[bondlines,'TotalPnL'] = self.th.positionsByISINBook.loc[bondlines,'SODPnL']/fx + self.th.positionsByISINBook.loc[bondlines,'TradePnL']/fx
             booklist = list(self.th.positionsByISINBook.loc[bondlines,'Book'].drop_duplicates())
             message = BondPriceUpdateMessage(bond=bond, booklist=booklist, price=price)
             pub.sendMessage('RISKTREE_BOND_PRICE_UPDATE', message=message)
         self.lock.release()
     pass
开发者ID:alex314159,项目名称:bondcharts,代码行数:30,代码来源:RiskTreeManager.py


示例19: scale_manual

 def scale_manual(self, event, val=None):
     a = P4Rm()
     if val is not None:
         P4Rm.ParamDict['DW_multiplication'] = val
     P4Rm.ParamDict['dwp'] = multiply(a.ParamDict['dwp'],
                                      a.ParamDict['DW_multiplication'])
     pub.sendMessage(pubsub_Re_Read_field_paramters_panel, event=event)
开发者ID:aboulle,项目名称:RaDMaX,代码行数:7,代码来源:Graph4Radmax.py


示例20: relayEvent

	def relayEvent(self):
		if self.selectedBrand and self.selectedMaterial is not None:
			self.chosenProfilePath = self.materialsDict.setdefault(self.selectedBrand, self.selectedMaterial)[self.selectedMaterial]
			try:
				pub.sendMessage('matProf.update', path=self.chosenProfilePath)
			except Exception as e:
				print "ERROR: ", e
开发者ID:ravikashchand,项目名称:Cura-Repo,代码行数:7,代码来源:materialProfileSelector.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pub.subscribe函数代码示例发布时间:2022-05-26
下一篇:
Python pubsub.Publisher类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap