Hi,
I'm having a hard time with modal dialogs in what is probably an unusual situation. To summarize, I'm having difficulty getting a modal window to appear in front of another modal window.
The details are that I have a python script that runs from an addon settings page using:
Code:
<setting default="" id="onStartup_test" label="32009" type="action" action="RunScript($CWD/resources/lib/tester.py, onStartup)" />
In the code from 'tester.py', if I create a normal dialog box using:
Code:
dialog = xbmcgui.Dialog()
dialog.ok(__language__(32049), msg)
It appears in front of the settings page dialog and all is well. But this dialog is too small to display the amount of text I need to show. So I first tried using xbmcgui and then pyXBMCt to create larger window dialog boxes, but when calling .domodal they remain hidden behind the settings dialog box. To test, I used the code from the first page of this thread:
Code:
from pyxbmct.addonwindow import *
class MyWindow(AddonDialogWindow):
def __init__(self, title=''):
# You need to call base class' constructor.
super(MyWindow, self).__init__(title)
# Set the window width, height and the grid resolution: 2 rows, 3 columns.
self.setGeometry(350, 150, 2, 3)
# Create a text label.
label = Label('This is a PyXBMCt window.', alignment=ALIGN_CENTER)
# Place the label on the window grid.
self.placeControl(label, 0, 0, columnspan=3)
# Create a button.
button = Button('Close')
# Place the button on the window grid.
self.placeControl(button, 1, 1)
# Set initial focus on the button.
self.setFocus(button)
# Connect the button to a function.
self.connect(button, self.close)
# Connect a key action to a function.
self.connect(ACTION_NAV_BACK, self.close)
# Create a window instance.
window = MyWindow('Hello, World!')
# Show the created window.
window.doModal()
Doing this, the modal window is created and I can see using the debugger that the code runs successfully, but in the GUI, the window is behind the settings dialog.
One small note, if you try to reproduce this - the code in pyxbmct/addonwindow.py needs to have the name of the addon hardcoded [_addon = xbmcaddon.Addon('myaddon')] because it is being called from a script outside the addon extension point. This does not cause me issues and in the actual code, I import the addon's own default.py and use classes and methods from there.
If you want to see the full situation, the project on GitHub is here:
https://github.com/KenV99/service.xbmc.c...llincluded I don't have the failed attempt currently in the file tester.py, but can add it if you need to see how I am calling it...
Thanks for this useful framework!