Kodi Community Forum
Release PyXBMCt: a Python framework for simple creating UI for XBMC addons - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Release PyXBMCt: a Python framework for simple creating UI for XBMC addons (/showthread.php?tid=174859)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-03

(2014-11-03, 20:08)Gameforus Wrote: Roman_v_M,

Could you take a look at this code below and tell me why the textbox don't show up?

Changing Control properties (using setText() and similar methods) must be done after a Control is added to your window with placeControl(). I.e. a Control must be added to the window immediately after it has been created. Then you can change its properties as you like: change text and such.
Also, as far as I can see, your window has 1 row and 3 columns, but your textbox occupies only one Grid cell. Is this supposed to be?


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-04

Thanks, i'll try that out tomorrow.

1 row 3 columns because i want textbox to be as twice as button (another control)

I want to add another Edit control in the window. Is there a way I can hide the Virtual keyboard when Edit Control is selected?


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-04

(2014-11-04, 02:20)Gameforus Wrote: I want to add another Edit control in the window. Is there a way I can hide the Virtual keyboard when Edit Control is selected?

I don't quite understand your question. A virtual keyboard is not opened automatically when Edit is selected. To activate the keyboard you need to click on the Edit control or press Enter. And the keyboard has the standard behavior: it closes on "Done" or ESC.
Please try the demo addon and see how the Controls work. There is no harm in that.Smile


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-04

I meant when Edit control is clicked or press Enter, the keyboard appear on screen. Is there a way to disable that virtual keyboard. I don't want it to display on screen since i will be using the advance remote with the keyboard on it already.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-04

(2014-11-04, 16:03)Gameforus Wrote: I meant when Edit control is clicked or press Enter, the keyboard appear on screen. Is there a way to disable that virtual keyboard. I don't want it to display on screen since i will be using the advance remote with the keyboard on it already.

Then don't click/press Enter, and just type your text on a physical keyboard without opening an on-screen keyboard. This is a standard behavior of Edit control in XBMC/Kodi. E.g. see text options in Kodi Settings.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-04

(2014-11-04, 16:13)Roman_V_M Wrote: Then don't click/press Enter, and just type your text on a physical keyboard without opening an on-screen keyboard. This is a standard behavior of Edit control in XBMC/Kodi. E.g. see text options in Kodi Settings.

It works that way Wink Thanks for all your help with your fast reply. PyXBMCt is awesome. It saves me lots of time coding


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - kroegtijger - 2014-11-05

I love this framework. It was exactly what i needed for displaying additional information. However, i still run into a little bump. Is it possible to make text scrolling inside a AddonDialogWindow? Alternative would be to add buttons for next and previous page, but scrolling would look a whole lot better.

Thanks


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-05

(2014-11-05, 03:23)kroegtijger Wrote: I love this framework. It was exactly what i needed for displaying additional information. However, i still run into a little bump. Is it possible to make text scrolling inside a AddonDialogWindow? Alternative would be to add buttons for next and previous page, but scrolling would look a whole lot better.

Thanks

Unfortunately TextBox control doesn't auto-scroll text and scroll() method doesn't seem to work. The only text control with auto-scrolling is FadeLabel, but it can hold only a single line.

Again, PyXBMCt is able to do only as much as underlying xbmcgui classes are able, with all their limitations and bugs. For real visual beauty you need to use skinned XML-based UI. PyXBMCt's strong sides are relative simplicity and Python-only approach.
We can only hope that someday some Kodi developer will find time to review and improve xbmcgui classes.
My personal wish list:
- Auto-scroll property for ControlTextBox.
- A vertical scroll-bar for ControlList (at least visual).
- Various keyboards for ControlEdit (as in input Dialog).
- A multi-select Dialog.
- A SpinBox control for selecting from a range of options.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-05

I took your code from page 1, and save it to C:/test.py. Then i edit the keymap\keyboard.xml to:
PHP Code:
<keymap>
    <global>
        <
keyboard>
            <
y>XBMC.RunScript(C:/test.py)</y>
        </
keyboard>
    </global>
</
keymap

How come when i hit y key, it doesn't populate the dialog below:

PHP Code:
# Import PyXBMCt module.
import pyxbmct.addonwindow as pyxbmct

# Create a window instance.
window pyxbmct.AddonDialogWindow('Hello, World!')
# Set the window width, height and the grid resolution: 2 rows, 3 columns.
window.setGeometry(35015023)
# Create a text label.
label pyxbmct.Label('This is a PyXBMCt window.'alignment=pyxbmct.ALIGN_CENTER)
# Place the label on the window grid.
window.placeControl(label00columnspan=3)
# Create a button.
button pyxbmct.Button('Close')
# Place the button on the window grid.
window.placeControl(button11)
# Set initial focus on the button.
window.setFocus(button)
# Connect the button to a function.
window.connect(buttonwindow.close)
# Connect a key action to a function.
window.connect(pyxbmct.ACTION_NAV_BACKwindow.close)
# Show the created window.
window.doModal()
# Delete the window instance when it is no longer used.
del window 

Could you please tell me what i did wrong?


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-05

(2014-11-05, 20:08)Gameforus Wrote: I took your code from page 1, and save it to C:/test.py. Then i edit the keymap\keyboard.xml to:
PHP Code:
<keymap>
    <global>
        <
keyboard>
            <
y>XBMC.RunScript(C:/test.py)</y>
        </
keyboard>
    </global>
</
keymap

How come when i hit y key, it doesn't populate the dialog below:

Could you please tell me what i did wrong?

Are using Kodi Helix 14.0? If yes, you should wrap your code into a proper addon structure. There's something weird going on with RunScript() function in 14.0, as discussed in the next topic.

And logs would certainly help, but please read the forum rules about posting logs.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-05

I'm still using Gotham 13.2.

I took a look at xbmc.log but there's no log about it. It looks like the script is not started it.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-05

(2014-11-05, 21:48)Gameforus Wrote: I'm still using Gotham 13.2.

I took a look at xbmc.log but there's no log about it. It looks like the script is not started it.

Anyway, as I said, you need to wrap your code into a proper addon structure.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-12

I managed to map your example to F1 key to test as below, but everytime i hit F1, it pop up another window. Is there a way to prevent that?

(2014-11-05, 20:08)Gameforus Wrote: I took your code from page 1, and save it to C:/test.py. Then i edit the keymap\keyboard.xml to:
PHP Code:
<keymap>
    <global>
        <
keyboard>
            <
y>XBMC.RunScript(C:/test.py)</y>
        </
keyboard>
    </global>
</
keymap


PHP Code:
# Import PyXBMCt module.
import pyxbmct.addonwindow as pyxbmct

# Create a window instance.
window pyxbmct.AddonDialogWindow('Hello, World!')
# Set the window width, height and the grid resolution: 2 rows, 3 columns.
window.setGeometry(35015023)
# Create a text label.
label pyxbmct.Label('This is a PyXBMCt window.'alignment=pyxbmct.ALIGN_CENTER)
# Place the label on the window grid.
window.placeControl(label00columnspan=3)
# Create a button.
button pyxbmct.Button('Close')
# Place the button on the window grid.
window.placeControl(button11)
# Set initial focus on the button.
window.setFocus(button)
# Connect the button to a function.
window.connect(buttonwindow.close)
# Connect a key action to a function.
window.connect(pyxbmct.ACTION_NAV_BACKwindow.close)
# Show the created window.
window.doModal()
# Delete the window instance when it is no longer used.
del window 



RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-13

(2014-11-12, 22:13)Gameforus Wrote: I managed to map your example to F1 key to test as below, but everytime i hit F1, it pop up another window. Is there a way to prevent that?

I've written that you need to wrap your code into a proper add-on structure 2 times already. PyXBMCt is meant for add-ons and has never been tested in standalone scripts. Its proper work in such scenarios is not guaranteed.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Gameforus - 2014-11-13

Thanks