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


Python wx_utils.modal_dialog函数代码示例

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


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


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