Unable to see a modalview

62 views
Skip to first unread message

VISHESH MANGLA

unread,
Apr 6, 2021, 3:01:09 AM4/6/21
to Kivy users support
Unable to get the modalview. Only spinner is visible.

from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
import kivy.properties as P
from kivy.animation import Animation
from kivy.uix.widget import Widget
from kivy.uix.modalview import ModalView

KV = '''

<KivyModelView@ModalView>:
    auto_dismiss:False
    background_color:1,1,1,1
    size_hint:(.8,.8)
    padding:[30,30,30,30]
    Loading:
    

<Loading@Widget>:
    angle: (app.time * 360) % 360
    radius: self.width
    canvas:
        Color:
            rgba: rgba('#FF4444')
        Line:
            width: 9
            ellipse: self.x, self.y, self.radius or 0, self.radius or 0, self.angle or 0, (self.angle or 0) + 90
        Line:
            width: 9
            ellipse: self.x, self.y, self.radius or 0, self.radius or 0, (self.angle or 0) + 180, (self.angle or 0) + 180 + 90
        SmoothLine:
            width: 10
            ellipse: self.x, self.y, self.radius or 0, self.radius or 0, self.angle or 0, (self.angle or 0) + 90
        SmoothLine:
            width: 10
            ellipse: self.x, self.y, self.radius or 0, self.radius or 0, (self.angle or 0) + 180, (self.angle or 0) + 180 + 90
FloatLayout:
    Loading:
        id: loading
        size_hint: None, None
        pos_hint: {'center': (.5, .8)}
        opacity: 1
    
    
'''
 

class Application(App):
    time = P.NumericProperty()
     
    def build(self):
        Clock.schedule_interval(self.update_time, 0)
        
        return Builder.load_string(KV)

    def update_time(selfdt):
        self.time += dt

if __name__ == "__main__":
    Application().run()

VISHESH MANGLA

unread,
Apr 6, 2021, 3:06:11 AM4/6/21
to Kivy users support
getting this -> https://ibb.co/0qLN2mx
want the spinner on the modalview  , on that modelview-->  https://ibb.co/3s40y1c

Elliot Garbus

unread,
Apr 6, 2021, 10:14:46 AM4/6/21
to kivy-...@googlegroups.com

You were not instancing or opening the ModalView.  I have added a button the main Window that instances and opens the Modal view.  Changes highlighted.

 

from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
import kivy.properties as P
from kivy.animation import Animation
from kivy.uix.widget import Widget
from kivy.uix.modalview import ModalView

KV =
'''
#:import Factory kivy.factory.Factory
    Button:
        size_hint_y: None
        height: 48
        pos_hint: {'y': 0}
        text: 'Open Modal View'
        on_release: Factory.KivyModelView().open()

           


'''


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e7f8b5ca-251b-407b-90ea-dc507605f7d4n%40googlegroups.com.

 

VISHESH MANGLA

unread,
Apr 6, 2021, 3:11:22 PM4/6/21
to Kivy users support
If that is working ,  then what is wrong with my actual code, in this I get the modelview , but I do not get the spinner on top of it.

Elliot Garbus

unread,
Apr 6, 2021, 3:43:52 PM4/6/21
to kivy-...@googlegroups.com

The link is to a code snippet, not the full code.  Run to code I’ve sent, and ask me questions about what you don’t understand.

VISHESH MANGLA

unread,
Apr 6, 2021, 11:29:13 PM4/6/21
to Kivy users support
I have edited the kv file slightly in the current gist.  The point I am trying to put emphasis on is if you see the highlighted lines here,  https://dpaste.org/F5t0#L1,2,3,4,5,6,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,35,36,37,38,39,40,41,42,119,121
     then our python code is the same. The only difference can be in our kv file where too the only thing I m not using is that FloatLayout:  which I  m expecting is the reason for the starting spinner in your code. But in my case I only want that until the network request happens the user should see a spinner. But I m getting an empty modalview unlike in your case here.
For full code :  https://github.com/XtremeGood/MailerKivy/tree/master               

Elliot Garbus

unread,
Apr 6, 2021, 11:51:38 PM4/6/21
to kivy-...@googlegroups.com

Lets do the experiments with the single file example.  When you get that working, you can transfer it to your larger program.  There is not enough context in the snippet, and your code base is big enough that I don’t want to invest the time to figure it out.

VISHESH MANGLA

unread,
Apr 7, 2021, 12:02:57 AM4/7/21
to Kivy users support
yes, your code is working, https://ibb.co/LtqR0Hx . I am not able to see any difference .

$ python -m mailer
[←[1;32mINFO←[0m   ] [Logger      ] Record log in C:\Users\Dell\.kivy\logs\kivy_21-04-07_6.txt
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[←[1;32mINFO←[0m   ] [Kivy        ] v2.0.0
[←[1;32mINFO←[0m   ] [Kivy        ] Installed at "C:\Users\Dell\OneDrive\Desktop\Mailer\venv\lib\site-packages\kivy\__init__.py"
[←[1;32mINFO←[0m   ] [Python      ] v3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]
[←[1;32mINFO←[0m   ] [Python      ] Interpreter at "C:\Users\Dell\OneDrive\Desktop\Mailer\venv\Scripts\python.exe"
[←[1;32mINFO←[0m   ] [Factory     ] 186 symbols loaded
[←[1;32mINFO←[0m   ] [Image       ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
[←[1;32mINFO←[0m   ] [Window      ] Provider: sdl2
[←[1;32mINFO←[0m   ] [GL          ] Using the "OpenGL" graphics system
[←[1;32mINFO←[0m   ] [GL          ] GLEW initialization succeeded
[←[1;32mINFO←[0m   ] [GL          ] Backend used <glew>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL version <b'4.6.0 - Build 27.20.100.8854'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL vendor <b'Intel'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 630'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL parsed version: 4, 6
[←[1;32mINFO←[0m   ] [GL          ] Shading version <b'4.60 - Build 27.20.100.8854'>
[←[1;32mINFO←[0m   ] [GL          ] Texture max size <16384>
[←[1;32mINFO←[0m   ] [GL          ] Texture max units <32>
[←[1;32mINFO←[0m   ] [Window      ] auto add sdl2 input provider
[←[1;32mINFO←[0m   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[←[1;32mINFO←[0m   ] [Text        ] Provider: sdl2
[←[1;32mINFO←[0m   ] [Loader      ] using a thread pool of 2 workers
[←[1;32mINFO←[0m   ] [Base        ] Start application main loop
[←[1;32mINFO←[0m   ] [GL          ] NPOT texture support is available
 
Does this help?

Elliot Garbus

unread,
Apr 7, 2021, 12:13:16 AM4/7/21
to kivy-...@googlegroups.com

The info below looks fine – I don’t see any obvious problems.

 

Make the edits you want in that single file program, and lets see if you can get it doing what you want.

Message has been deleted

VISHESH MANGLA

unread,
Apr 7, 2021, 3:42:25 AM4/7/21
to Kivy users support
https://dpaste.org/Ggd5     Can you make this work then?

VISHESH MANGLA

unread,
Apr 7, 2021, 3:43:47 AM4/7/21
to Kivy users support
It's all black here but at least in my original big code I get the modelview.

Elliot Garbus

unread,
Apr 7, 2021, 9:08:20 AM4/7/21
to kivy-...@googlegroups.com

Your kv code did not contain a root widget.  Adding a BoxLayout as a root widget, and the modal view comes up:

 

import kivy.properties as P
from kivy.animation import Animation
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.modalview import ModalView
from kivy.uix.widget import Widget

KV =
"""
BoxLayout:
   
        
"""
from kivy.factory import Factory


class Application(App):
    time = P.NumericProperty()

   
def on_start(self):
       
self.modelview = Factory.KivyModelView().open()

   
def build(self):

        Clock.schedule_interval(
self.update_time, 0)

       
return Builder.load_string(KV)

   
def update_time(self, dt):
       
self.time += dt


VISHESH MANGLA

unread,
Apr 7, 2021, 9:36:51 AM4/7/21
to Kivy users support
Yes, thanks @ElliotG , it was that.  But in my original code the problem was of the timing, first the ModalView was initialized and then the .open() method was called.That was the issue

VISHESH MANGLA

unread,
Apr 7, 2021, 9:38:06 AM4/7/21
to Kivy users support
Still I do not know how to fix it, maybe overriding open will fix it.

Elliot Garbus

unread,
Apr 7, 2021, 9:44:04 AM4/7/21
to kivy-...@googlegroups.com

Glad you got it figured out.

VISHESH MANGLA

unread,
Apr 7, 2021, 9:46:48 AM4/7/21
to Kivy users support
Well, I figured out the problem but have no solution yet, overriding .open() was a no-op. 


Further creating a new function and calling it gave this traceback

VISHESH MANGLA

unread,
Apr 7, 2021, 9:54:50 AM4/7/21
to Kivy users support


class MailerApp(App):
    def on_start(self):

        data = {
            "license_key": App.get_running_app().config.get("licensing""license_key"),
            "token": App.get_running_app().config.get("licensing""token"),
        }

        if not all(data.values()):
            Factory.LicenseModalView().open()

        else:
            modalview = Factory.LoadingModalView()
            modalview.open()
            Clock.schedule_interval(modalview.update_time, 0)
            modalview.is_license_valid()


Fixed that little error but spinner still doesn't show up

Elliot Garbus

unread,
Apr 7, 2021, 9:55:18 AM4/7/21
to kivy-...@googlegroups.com

Looks like a spelling error:

self.modalview = Factory.LoadingModalView().open()

self.modelview.start_checking()

VISHESH MANGLA

unread,
Apr 7, 2021, 9:57:10 AM4/7/21
to Kivy users support
Sorry, for that.

Elliot Garbus

unread,
Apr 7, 2021, 11:23:43 AM4/7/21
to kivy-...@googlegroups.com

Create a runnable example.

VISHESH MANGLA

unread,
Apr 7, 2021, 12:39:13 PM4/7/21
to kivy-...@googlegroups.com
@ElliotG , the problem was  <LoadingModelView> instead of LoadingModalView> , lol. I couldn't have found it if you would not have told me earlier. Thanks a lot!

Elliot Garbus

unread,
Apr 7, 2021, 12:52:27 PM4/7/21
to kivy-...@googlegroups.com
😎

Sent from my iPhone

On Apr 7, 2021, at 9:39 AM, VISHESH MANGLA <f201...@pilani.bits-pilani.ac.in> wrote:


Reply all
Reply to author
Forward
0 new messages