Re: Questions in relation to properties fields and code structure.

Dietmar Schwertberger <[email protected]> Mon, 15 May 2023 18:19:19 +0200
Newsgroups gmane.comp.python.wxglade
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============7919531147896719329==
Content-Type: multipart/alternative;
 boundary="------------KXuHg1XJYNMDbXkyvB9jVtlr"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------KXuHg1XJYNMDbXkyvB9jVtlr
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Sean,

I assume you found the screen reader related settings in Edit -> 
Preferences -> Accessibility?


The field for Instance Class is e.g. if you have a search widget that is 
derived from wx.TextCtrl.
I'm sometimes using this when I'm writing measurement and control 
software where my class has functionality to handle units and ranges. If 
you have written some basic widgets that are aware of your data, then 
this might be the way to go. In the code that derives from the generated 
Frame class, you would tie the widgets together.

You could for example create three identical tabs in wxGlade, including 
treeview, search field and listview.
Then you can either handle all events in your frame class that is 
derived from your wxGlade-generated frame.
Or you could set the instance classes of your tree/text/list widgets to 
classes you have created. This can move lowlevel stuff out of your 
application to make things easier to maintain.

You could alternatively write a base class for your panel that ties 
together your tree/text/list widgets. Then enter the base class name 
into "Base class(es)". I have not tested this myself, I think. Your base 
class would have to create the child widgets itself or use 
self.GetChildren() to find them.

Alternatively, you could create a Panel for your superclass and set the 
code generation to "Separate file for each class". You would then derive 
a class from this. Then you would add three empty panels to your main 
Frame's notebook and use your class name for "Instance class".

Basically, there are many options. I don't see how to document this in a 
way that actually helps the user other than the current tooltips and 
trial & error. I admit, that when using a screen reader this trial & 
error process is not very nice.
Actually, the more generic your classes get and the more general and 
dynamic your application gets, the less you will benefit from a GUI 
builder. E.g. if you were to implement a document editor, then you would 
use a GUI builder for main frame, dialogs and maybe the menu. You would 
not use it for the document editing itself.
So, my recommendation for learning wxPython is to start with the easiest 
option and improve later on: create all in wxGlade and handle all 
events. Once things are working, you may find structures that are 
repeating and which you want to refactor. Your library program seems a 
reasonable target for learning.


The focus option is for setting the inital keyboard input focus when the 
window is created. You should only set it for exactly one widget per 
window or notebook tab. You don't need to set it if it's fine to use the 
first one as default.
On Windows the focused widget is highlighted in blue.


Regards,
Dietmar




> When you inform WXGlade to use a class and then define a base class. 
> How do you reference the code for the base class assuming you have to 
> create it? Could a base class be the same layout structure as I 
> indicated with myTitlePanel? The documentation doesn’t relay explain this.
>

--------------KXuHg1XJYNMDbXkyvB9jVtlr
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Sean,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I assume you found the screen reader
      related settings in Edit -&gt; Preferences -&gt; Accessibility?</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The field for Instance Class is e.g. if
      you have a search widget that is derived from wx.TextCtrl.</div>
    <div class="moz-cite-prefix">I'm sometimes using this when I'm
      writing measurement and control software where my class has
      functionality to handle units and ranges. If you have written some
      basic widgets that are aware of your data, then this might be the
      way to go. In the code that derives from the generated Frame
      class, you would tie the widgets together.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">You could for example create three
      identical tabs in wxGlade, including treeview, search field and
      listview.</div>
    <div class="moz-cite-prefix">Then you can either handle all events
      in your frame class that is derived from your wxGlade-generated
      frame.</div>
    <div class="moz-cite-prefix">Or you could set the instance classes
      of your tree/text/list widgets to classes you have created. This
      can move lowlevel stuff out of your application to make things
      easier to maintain.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">You could alternatively write a base
      class for your panel that ties together your tree/text/list
      widgets. Then enter the base class name into "Base class(es)". I
      have not tested this myself, I think. Your base class would have
      to create the child widgets itself or use self.GetChildren() to
      find them.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Alternatively, you could create a Panel
      for your superclass and set the code generation to "Separate file
      for each class". You would then derive a class from this. Then you
      would add three empty panels to your main Frame's notebook and use
      your class name for "Instance class".</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Basically, there are many options. I
      don't see how to document this in a way that actually helps the
      user other than the current tooltips and trial &amp; error. I
      admit, that when using a screen reader this trial &amp; error
      process is not very nice.<br>
    </div>
    <div class="moz-cite-prefix">Actually, the more generic your classes
      get and the more general and dynamic your application gets, the
      less you will benefit from a GUI builder. E.g. if you were to
      implement a document editor, then you would use a GUI builder for
      main frame, dialogs and maybe the menu. You would not use it for
      the document editing itself.</div>
    <div class="moz-cite-prefix">So, my recommendation for learning
      wxPython is to start with the easiest option and improve later on:
      create all in wxGlade and handle all events. Once things are
      working, you may find structures that are repeating and which you
      want to refactor. Your library program seems a reasonable target
      for learning.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The focus option is for setting the
      inital keyboard input focus when the window is created. You should
      only set it for exactly one widget per window or notebook tab. You
      don't need to set it if it's fine to use the first one as default.<br>
    </div>
    <div class="moz-cite-prefix">On Windows the focused widget is
      highlighted in blue.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Regards,</div>
    <div class="moz-cite-prefix">Dietmar<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
      cite="mid:[email protected]">
      <div class="WordSection1">
        <p class="MsoNormal">When you inform WXGlade to use a class and
          then define a base class. How do you reference the code for
          the base class assuming you have to create it? Could a base
          class be the same layout structure as I indicated with
          myTitlePanel? The documentation doesn’t relay explain this.<o:p></o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------KXuHg1XJYNMDbXkyvB9jVtlr--


--===============7919531147896719329==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7919531147896719329==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
wxGlade-general mailing list
wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/wxglade-general

--===============7919531147896719329==--