Plugin: Ask for user input

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
MrFinn Offline
Junior Member
Posts: 10
Joined: Jun 2010
Reputation: 0
Post: #1
I can't find it in the forum or the wiki, is there a way to ask for a user to input some text in a plugin?

Basically I want to ask a user for a string, then search a website based on that string.

Thanks.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,570
Joined: Oct 2003
Reputation: 138
Post: #2
Various plugins do this - basically you pop up the virtual keyboard to grab the string.

Take a nosy through the youtube plugin as an example perhaps? A simple example where this is done that we can add to the docs would be useful.

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
linuxluemmel Offline
Member+
Posts: 872
Joined: Jun 2009
Reputation: 0
Location: Lucern / Switzerland
Post: #3
MrFinn Wrote:I can't find it in the forum or the wiki, is there a way to ask for a user to input some text in a plugin?

Basically I want to ask a user for a string, then search a website based on that string.

Thanks.

Here is a sample
Code:
#########################################################
# Function  : GUIEditExportName                         #
#########################################################
# Parameter :                                           #
#                                                       #
# name        sugested name for export                  #
#                                                       #
# Returns   :                                           #
#                                                       #
# name        name of export excluding any extension    #
#                                                       #
#########################################################
def GUIEditExportName(name):

    exit = True
    while (exit):
          kb = xbmc.Keyboard('default', 'heading', True)
          kb.setDefault(name)
          kb.setHeading(__language__(33223))
          kb.setHiddenInput(False)
          kb.doModal()
          if (kb.isConfirmed()):
              name_confirmed  = kb.getText()
              name_correct = name_confirmed.count(' ')
              if (name_correct):
                 GUIInfo(2,__language__(33224))
              else:
                   name = name_confirmed
                   exit = False
          else:
              GUIInfo(2,__language__(33225))
    return(name)
  
#########################################################
find quote
MrFinn Offline
Junior Member
Posts: 10
Joined: Jun 2010
Reputation: 0
Post: #4
Nice, that worked great. Thanks.
find quote