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

Python wx_utils.modal_dialog函数代码示例

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

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



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

示例1: ListUrls

 def ListUrls(self, buffer=None, index=None):
  """List any URLs or mentions of a twitter screen name in a dialog."""

  urls = []
  try:
   urls.extend(buffer.get_urls(index))
  except:
   pass
  try:
   urls.extend(["@%s" % i for i in buffer.get_mentions(index)])
  except:
   pass
  try:
   urls.extend(["@%s" % buffer.get_screen_name(index)])
  except:
   pass
  urls = misc.RemoveDuplicates(urls)
  if not urls:
   logging.debug("No web addresses or usernames in current tweet.")
   return output.speak(_("No URLs detected in current post."), 1)
  logging.debug("Launching URL choice dialog.")
  dlg = modal_dialog(core.gui.ListURLsDialog, parent=self.session.frame, urls=urls)
  url = dlg.urls_list.GetStringSelection().replace("@","http://ww	w.twitter.com/")
  logging.debug("Opening URL: %s " % url)
  misc.open_url_in_browser(url)
开发者ID:Piciok,项目名称:TheQube,代码行数:25,代码来源:interface.py


示例2: export

 def export(self, dlg=None):
  """Writes items in a buffer to an external file."""
  if dlg is None:
   dlg = modal_dialog(gui.export.MainExportDialog, parent=self.session.frame, id=wx.ID_ANY)
  if not dlg.IsExportAvailable():
   output.speak(_("The export function is not available."), True)
  else:
    output.speak(_("Export started, please wait."), True)
    try:
     exporter = dlg.GetExporter()
     exporter.Run()
     output.speak(_("Export complete"), False)
     if dlg.format.exportMore.GetValue():
      index = dlg.items.get_buffer_index()
      if index != wx.NOT_FOUND:
       index += 1
      if dlg.items.buffer.GetCount() > 0 and (index == wx.NOT_FOUND or index >= dlg.items.buffer.GetCount()):
       index = 0
      dlg.items.set_bufferIndex(index)
      dlg.format.filename.SetValue("")
      return wx.CallAfter(self.export, dlg=dlg)
    except:
     logging.exception("Export failed.")
     output.speak(_("Export failed."), False)
     return wx.CallAfter(self.export, dlg = dlg)
开发者ID:Piciok,项目名称:TheQube,代码行数:25,代码来源:interface.py


示例3: LocalTrends

 def LocalTrends(self):
  """Creates a buffer containing the trends for the specified location."""

  output.speak(_("Retrieving locations."), True)
  try:
   locations = self.session.TwitterApi.get_available_trends()
   logging.debug("Raw locations: %s" % str(locations))
  except:
   logging.debug("Unable to obtain local trend locations.")
   return output.speak(_("Unable to retrieve local trend locations; please try again later."), True)
  locations.sort(key=lambda location: location['name'])
  locations_by_name = {}
  locations_tree = {}
  for location in locations:
   type = location['placeType']['name']
   place = location['name']
   if place == "Worldwide":
    continue
   locations_by_name[place] = location
   if type not in locations_tree.keys():
    locations_tree[type] = []
   locations_tree[type].append(place)
  dlg = modal_dialog(gui.LocalTrendsDialog, parent=self.session.frame, id=wx.ID_ANY, locations_tree=locations_tree)
  if dlg.locations_list.GetSelection() == wx.NOT_FOUND:
   choice = dlg.locations_list.GetItems()[0]
  else:
   choice = dlg.locations_list.GetStringSelection()
  location = locations_by_name[choice]
  self.session.register_buffer(_("Trending: %s" % location['name']), buffers.LocalTrends, woeid=location['woeid'])
开发者ID:Piciok,项目名称:TheQube,代码行数:29,代码来源:interface.py


示例4: ViewUserTimeline

 def ViewUserTimeline(self, buffer=None, index=None):
  """Creates a buffer containing the timeline of the specified user."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.IndividualDialog, parent=self.session.frame, users=who)
  who = new.users.GetValue()
  self.session.register_buffer(_("%s's timeline") % who, buffers.Individual, username=who, count = new.retrieveCount.GetValue(), maxAPIPerUpdate = new.maxAPIPerUpdate.GetValue(), prelaunch_message=_("Loading timeline for %s.") % who)
开发者ID:Piciok,项目名称:TheQube,代码行数:7,代码来源:interface.py


示例5: NewReply

 def NewReply(self, buffer=None, index=None, text="", user=None):
  """Allows you to post a reply to a tweet."""

  default = user
  users = buffer.get_all_screen_names(index)
  if 'source' not in buffer[index] and 'text' in buffer[index] and self.session.config['UI']['DMSafeMode']:
   return self.NewDm(buffer, index, text)
  if not self.session.config['UI']['replyToSelf']:
   for n, u in enumerate(users):
    if self.session.is_current_user(u):
     users.remove(users[n])
  if default:
   users.insert(0, default)
  if not users:
   return output.speak(_("Unable to detect a user to reply to."), True)
  new = modal_dialog(gui.NewReplyDialog, parent=self.session.frame, default=users[0], selection=users, title=_("Reply"), text=text)
  user = new.selection.GetValue()
  fulltext = templates.replyTemplate(user, new.message.GetValue())
  if len(fulltext) > self.session.config['lengths']['tweetLength']:
   i = fulltext.index(" ") + 1
   return self.NewReply(buffer, index, fulltext[i:])
  if new.delay:
   delay_action(new.delay, self.session.post_reply, buffer=buffer, index=index, text=fulltext, action=_("reply"))
  else:
   call_threaded(self.session.post_reply, buffer=buffer, index=index, text=fulltext)
开发者ID:Piciok,项目名称:TheQube,代码行数:25,代码来源:interface.py


示例6: FavoritesFor

 def FavoritesFor(self, buffer=None, index=None):
  """Creates a buffer containing the tweets the specified user has favorited."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.FavoritesDialog, parent=self.session.frame, users=who, results_per_api=200)
  who = new.users.GetValue()
  name = _("%s's favorites") % who
  self.session.register_buffer(name, buffers.Favorites, username=who, count=new.retrieveCount.GetValue(), maxAPIPerUpdate=new.maxAPIPerUpdate.GetValue(), prelaunch_message=_("Loading favorites for %s.") % who)
开发者ID:Piciok,项目名称:TheQube,代码行数:8,代码来源:interface.py


示例7: SMSReply

 def SMSReply(self, buffer=None, index=None, text=""):
  phone_number = str(buffer.get_phone_number(index))
  if not phone_number:
   return output.speak(_("Unable to detect a sender to reply to."), True)
  numbers = [phone_number]
  new = modal_dialog(gui.SMSDialog, parent=self.session.frame, default=phone_number, selection=numbers, title=_("Reply"), text=text)
  self.session.gv.send_sms(new.selection.GetValue(), new.message.GetValue())
  output.speak(_("Reply sent to %s" % new.selection.GetValue()))
开发者ID:RN3ARA,项目名称:TheQube,代码行数:8,代码来源:interface.py


示例8: CountdownTimer

 def CountdownTimer(self):
  """Create a timer to count down from the time specified to 0, at which point you will be notified."""

  dlg = modal_dialog(gui.CountdownDialog, parent=self.session.frame, title=_("Countdown Timer"))
  name = dlg.name.GetValue()
  time = dlg.get_time()
  self.session.create_countdown(name, time)
  output.speak(_("Counting."), True)
开发者ID:FBSLikan,项目名称:TheQube,代码行数:8,代码来源:interface.py


示例9: friendsFor

 def friendsFor (self, buffer=None, index=None):
  """Creates a buffer containing the people the specified user is following."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.FriendsDialog, parent=self.session.frame, users=who, results_per_api=100)
  who = new.users.GetValue()
  api = new.maxAPIPerUpdate.GetValue()
  name = _("%s's friends") % who
  self.session.register_buffer(name, buffers.Friends, username=who, maxAPIPerUpdate=api, prelaunch_message=_("Loading friends for %s.") % who)
开发者ID:RN3ARA,项目名称:TheQube,代码行数:9,代码来源:interface.py


示例10: followersFor

 def followersFor(self, buffer=None, index=None):
  """Creates a buffer containing the people that are following the specified user."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.FollowersDialog, parent=self.session.frame, users=who)
  who = new.users.GetValue()
  retrieveCount = new.retrieveCount.GetValue()
  maxAPIPerUpdate = new.maxAPIPerUpdate.GetValue()
  name = _("%s's followers") % who
  self.session.register_buffer(name, buffers.Followers, username=who, count = retrieveCount, maxAPIPerUpdate = maxAPIPerUpdate, prelaunch_message=_("Loading friends for %s.") % who)
开发者ID:Piciok,项目名称:TheQube,代码行数:10,代码来源:interface.py


示例11: followersFor

 def followersFor(self, buffer=None, index=None):
  """Creates a buffer containing the people that are following the specified user."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.FollowersDialog, parent=self.session.frame, users=who, results_per_api=100)
  who = new.users.GetValue()
  api = new.maxAPIPerUpdate.GetValue()
  output.speak(_("Loading followers for %s.") % who, True)
  name = _("%s's followers") % who
  self.session.register_buffer(name, buffers.Followers, username=who, maxAPIPerUpdate = api)
开发者ID:RN3ARA,项目名称:TheQube,代码行数:10,代码来源:interface.py


示例12: Follow

 def Follow(self, buffer=None, index=None):
  """Allows you to follow the specified user."""

  who = buffer.get_all_screen_names(index)
  if not who:
   output.speak(_("No users to follow detected in current post."), True)
   return logging.debug("No users to follow detected in current post.")
  new = modal_dialog(gui.FollowDialog, parent=self.session.frame, users=who)
  who = new.users.GetValue()
  updates = new.updates.GetValue()
  call_threaded(self.session.follow, who, updates)
开发者ID:Piciok,项目名称:TheQube,代码行数:11,代码来源:interface.py


示例13: UserInfoDialog

 def UserInfoDialog(self, buffer=None, index=None):
  """Displays a dialog containing information such as the screen name, real name, whether or not tweets are protected, etc, for the specified user."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.UserInfoDialog, parent=self.session.frame, users=who)
  who = new.users.GetValue()
  output.speak(_("Loading profile for %s") % who, True)
  user_ptr = self.session.TwitterApi.show_user(screen_name=who)
  logging.debug("UserInfoDialog: Twitter returned user profile for %s as \n%s" % (who, user_ptr))
  new = gui.TwitterProfileDialog(parent=self.session.frame, id=wx.ID_ANY, user=user_ptr)
  new.ShowModal()
开发者ID:Piciok,项目名称:TheQube,代码行数:11,代码来源:interface.py


示例14: Unfollow

 def Unfollow(self, buffer=None, index=None):
  """Allows you to unfollow, block, or report the specified user as a spammer."""

  who = buffer.get_all_screen_names(index)
  if not who:
   output.speak(_("No users to unfollow detected in current post."), True)
   return logging.debug("No users to unfollow detected in current post.")
  new = modal_dialog(gui.UnfollowDialog, parent=self.session.frame, users=who)
  who = new.users.GetValue()
  action = new.action.GetSelection()
  call_threaded(self.session.do_unfollow, who, action)
开发者ID:Piciok,项目名称:TheQube,代码行数:11,代码来源:interface.py


示例15: JumpToPost

 def JumpToPost(self, buffer=None):
  """Moves you to the item of the specified index in the current buffer."""

  new = modal_dialog(gui.JumpToPostDialog, parent=self.session.frame, buffer=buffer)
  num = int(new.number.GetValue())
  if num > len(buffer):
   output.speak(_("Item number too high."), True)
   return self.JumpToPost(buffer=buffer)
  num = num-1
  index = len(buffer)-1 - num
  buffer.index = index
  buffer.speak_item()
开发者ID:Piciok,项目名称:TheQube,代码行数:12,代码来源:interface.py


示例16: ChangeKeymap

    def ChangeKeymap(self):
        """Allows you to change the keystrokes used to control TheQube."""

        @always_call_after
        def replace_keymap(new):
            self.session.unregister_hotkeys()
            self.session.keymap.clear()
            self.session.keymap.update(new)
            self.session.set_active_keymap(self.session.keymap)
            self.session.save_config()
            output.speak(_("Keymap saved."), True)

        dlg = modal_dialog(KeymapDialog, parent=self.session.frame)
        replace_keymap(dlg.new_keymap)
开发者ID:FBSLikan,项目名称:TheQube,代码行数:14,代码来源:interface.py


示例17: NewDm

 def NewDm(self, buffer=None, index=None, user="", text=""):
  """Allows you to send a new direct message to a user."""

  who = buffer.get_all_screen_names(index)
  new = modal_dialog(gui.NewDirectDialog, parent=self.session.frame, default=who[0], selection=who, title=_("Direct message"), text=text)
  user = new.selection.GetValue()
  text = new.message.GetValue()
  if len(text) > self.session.config['lengths']['tweetLength']:
   logging.info("Direct message too long.  Forcing edit.")
   return self.NewDm (buffer, index, user, text)
  if new.delay:
   delay_action(new.delay, self.session.post_dm, text=text, buffer=buffer, index=index, user=user, action=_("dm"))
  else:
   call_threaded(self.session.post_dm, buffer=buffer, index=index, user=user, text=text)
开发者ID:Piciok,项目名称:TheQube,代码行数:14,代码来源:interface.py


示例18: call

 def call(self):
  dlg = modal_dialog(gui.CallDialog, parent=self.session.frame, title=_("Call Phone"))
  number = int(dlg.number.GetValue())
  if not number:
   output.speak(_("Please enter a phone number to call."), 1)
   return self.call()
  fp_formatted = dlg.forwardingPhone.GetValue()
  if not fp_formatted:
   output.speak(_("Please indicate where the call should be bridged by selecting a forwarding phone number."), 1)
   return self.call()
  if fp_formatted not in self.session.source_numbers():
   return output.speak(_("Error, forwarding phone number not found."), True)
  output.speak(_("Calling: %r") % number, True)
  self.session.gv.call(number, self.session.unformat_phone_number(fp_formatted))
  output.speak(_("Call placed."))
开发者ID:RN3ARA,项目名称:TheQube,代码行数:15,代码来源:interface.py


示例19: TranslateTweet

 def TranslateTweet(self, buffer=None, index=None):
  """Translate the current tweet into another language with Google Translate service."""

  try:
   text_to_translate = buffer.get_text(index).encode("UTF-8")
  except:
   text_to_translate = buffer.format_item(index).encode("UTF-8")
  dlg = modal_dialog(core.gui.TranslateDialog, parent=self.session.frame)
  source = dlg.langs_keys[dlg.source_lang_list.GetSelection()]
  target = dlg.langs_keys[dlg.target_lang_list.GetSelection()]
  try:
   translated_text = dlg.t.translate(text_to_translate, target, source)
  except Exception as e:
   logging.exception("Translation error: {0}".format(e))
   output.speak(_("Translation process has failed."), True)
  self.NewTweet(text=translated_text, title=_("Translation from %s to %s") % (dlg.langs_values[dlg.source_lang_list.GetSelection()], dlg.langs_values[dlg.target_lang_list.GetSelection()]), retweet=True)
开发者ID:craigbrett17,项目名称:TheQube,代码行数:16,代码来源:interface.py


示例20: RelationshipStatusBetween

 def RelationshipStatusBetween(self, buffer=None, index=None):
  """Determine the relationship status between any two users"""

  username = self.session.username
  who = buffer.get_all_screen_names(index)
  if len(who) > 1 or who[0] != "":
   try:
    who.remove(username)
   except:
    pass
   who.append(username)
  new = modal_dialog(gui.RelationshipStatusDialog, parent=self.session.frame, users=who)
  user1 = new.users.GetValue()
  user2 = new.users2.GetValue()
  output.speak(_("Retrieving relationship status between %s and %s") % (user1, user2), True)
  call_threaded(self.session.relationship_status_between, user1, user2)
开发者ID:Piciok,项目名称:TheQube,代码行数:16,代码来源:interface.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils2.i18n函数代码示例发布时间:2022-05-26
下一篇:
Python wait.wait_for函数代码示例发布时间: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