[qmtest] GUI changes
Mark Mitchell
mark at codesourcery.com
Wed Jan 1 03:36:23 UTC 2003
--On Monday, December 16, 2002 11:56:44 AM +0300 Vladimir Prus
<ghost at cs.msu.su> wrote:
> Mark Mitchell wrote:
>> --On Monday, December 16, 2002 10:19:55 AM +0300 Vladimir Prus
>>
>> <ghost at cs.msu.su> wrote:
>> > I'm probably late making this comment, but recent GUI changes
>> > are probably not as good. Whenever I move a mouse over
>> > menu, it pops up. That's very annoying when I just want to click
>> > "back" or "forward" button. Somehow I use those very often.
>>
>> What about changing the menus so that you have to click on them to
>> activate them?
>>
>> We can do that easily -- by changing the "onmouseover" handler to be
>> an "onclick" handler, and perhaps fiddling some of the other stuff.
>>
>> Thoughts?
>
> This looks like a good idea!
I applied this patch to the mainline to implement this idea.
You will want to put:
[common]
click_menus=1
in your ~/.qmrc file.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2002-12-31 Mark Mitchell <mark at codesourcery.com>
* doc/manual/common-manual.xml: Document click_menus option.
* qm/common.py (RcConfiguration): Derive from ConfigParser.
(RcConfiguration.__init__): Load the configuration file.
(RcConfiguration.Load): Do not call __Load.
(RcConfiguration.Get): Simplify.
(RcConfiguration.GetOptions): Likewise.
(RcConfiguration.__Load): Remove it.
* qm/test/share/dtml/navigation-bar.dtml: Suppose clickable menus.
* qm/test/web/web.py (QMTestPage.GenerateStartBody): Likewise.
Index: doc/manual/common-manual.xml
===================================================================
RCS file: /home/qm/Repository/qm/doc/manual/common-manual.xml,v
retrieving revision 1.8
diff -c -p -r1.8 common-manual.xml
*** doc/manual/common-manual.xml 28 Nov 2002 23:09:59 -0000 1.8
--- doc/manual/common-manual.xml 1 Jan 2003 03:35:32 -0000
*************** browser=/usr/local/bin/mozilla
*** 84,89 ****
--- 84,119 ----
<glossentry>
<glossterm>
+ <property>click_menus</property>
+ </glossterm>
+ <glossdef>
+ <para>If this option is not present, or has the value
+ <literal>0</literal>, menus in the
+ GUI are activated by moving the mouse over the menu name.
+ </para>
+
+ <para>If this option has the value <literal>1</literal>, the
+ menus are activated by clicking on the menu name.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry>
+ <glossterm>
+ <property>remote_shell</property> (UNIX-like platforms only)
+ </glossterm>
+ <glossdef>
+ <para>The program used for running commands on remote computers.
+ The program must accept the same syntax as the standard
+ <filename>rsh</filename> command, and should be configured to run
+ the command remotely without any additional interaction (such as
+ requesting a password from the TTY). The default value is
+ <filename>/usr/bin/ssh</filename>.</para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry>
+ <glossterm>
<property>script_shell</property>
</glossterm>
<glossdef>
*************** browser=/usr/local/bin/mozilla
*** 109,128 ****
compatible replacement. This program is used for sending email
messages. The default value is
<filename>/usr/lib/sendmail</filename>.</para>
- </glossdef>
- </glossentry>
-
- <glossentry>
- <glossterm>
- <property>remote_shell</property> (UNIX-like platforms only)
- </glossterm>
- <glossdef>
- <para>The program used for running commands on remote computers.
- The program must accept the same syntax as the standard
- <filename>rsh</filename> command, and should be configured to run
- the command remotely without any additional interaction (such as
- requesting a password from the TTY). The default value is
- <filename>/usr/bin/ssh</filename>.</para>
</glossdef>
</glossentry>
--- 139,144 ----
Index: qm/common.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/common.py,v
retrieving revision 1.67
diff -c -p -r1.67 common.py
*** qm/common.py 11 Nov 2002 16:08:01 -0000 1.67
--- qm/common.py 1 Jan 2003 03:35:32 -0000
*************** class PythonException(QMException):
*** 128,134 ****
# classes
########################################################################
! class RcConfiguration:
"""Interface object to QM configuration files.
Configuration files are in the format parsed by the standard
--- 128,134 ----
# classes
########################################################################
! class RcConfiguration(ConfigParser.ConfigParser):
"""Interface object to QM configuration files.
Configuration files are in the format parsed by the standard
*************** class RcConfiguration:
*** 141,156 ****
def __init__(self):
"""Create a new configuration instance."""
! self.__parser = None
def Load(self, section):
"""Load configuration.
'section' -- The configuration section from which subsequent
! varaibles are loaded."""
- self.__parser = self.__Load()
self.__section = section
--- 141,162 ----
def __init__(self):
"""Create a new configuration instance."""
! ConfigParser.ConfigParser.__init__(self)
! if os.environ.has_key("HOME"):
! home_directory = os.environ["HOME"]
! rc_file = os.path.join(home_directory, self.user_rc_file_name)
! # Note that it's OK to call 'read' even if the file doesn't
! # exist. In that, case the parser simply will not
! # accumulate any data.
! self.read(rc_file)
def Load(self, section):
"""Load configuration.
'section' -- The configuration section from which subsequent
! variables are loaded."""
self.__section = section
*************** class RcConfiguration:
*** 168,182 ****
precondition -- The RC configuration must be loaded."""
- if self.__parser is None:
- # No RC file was ever loaded. Print a warning the first
- # time.
- if not hasattr(self, "no_rc_loaded_warning"):
- sys.stderr.write("Warning: No RC configuration file
loaded.\n")
- self.no_rc_loaded_warning = 1
- # Use the default.
- return default
-
# Use the previously-specified default section, if one wasn't
# specified explicitly.
if section is None:
--- 174,179 ----
*************** class RcConfiguration:
*** 184,190 ****
try:
# Try to get the requested option.
! return self.__parser.get(section, option)
except ConfigParser.NoSectionError:
# Couldn't find the section.
return default
--- 181,187 ----
try:
# Try to get the requested option.
! return self.get(section, option)
except ConfigParser.NoSectionError:
# Couldn't find the section.
return default
*************** class RcConfiguration:
*** 206,212 ****
if section is None:
section = self.__section
try:
! options = self.__parser.options(section)
except ConfigParser.NoSectionError:
# Couldn't find the section.
return []
--- 203,209 ----
if section is None:
section = self.__section
try:
! options = self.options(section)
except ConfigParser.NoSectionError:
# Couldn't find the section.
return []
*************** class RcConfiguration:
*** 217,245 ****
options.remove("__name__")
return options
!
! def __Load(self):
! """Load the configuration from the appropriate places."""
!
! # Create a parser.
! parser = ConfigParser.ConfigParser()
!
! # Construct the path to the user's rc file.
! if os.environ.has_key("HOME"):
! home_directory = os.environ["HOME"]
! rc_file = os.path.join(home_directory, self.user_rc_file_name)
! # Note that it's OK to call 'read' even if the file doesn't
! # exist. In that, case the parser simply will not accumulate
! # any data.
! parser.read(rc_file)
! else:
! # If we cannot find the user's home directory, do not
! # even try to read the configuration.
! pass
!
! return parser
!
!
########################################################################
# functions
########################################################################
--- 214,220 ----
options.remove("__name__")
return options
!
########################################################################
# functions
########################################################################
Index: qm/test/share/dtml/navigation-bar.dtml
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/share/dtml/navigation-bar.dtml,v
retrieving revision 1.4
diff -c -p -r1.4 navigation-bar.dtml
*** qm/test/share/dtml/navigation-bar.dtml 29 Nov 2002 04:11:29 -0000 1.4
--- qm/test/share/dtml/navigation-bar.dtml 1 Jan 2003 03:35:33 -0000
***************
*** 36,47 ****
base="name + '_base'"
menu="name + '_menu'">
<td width="20%" class="menu_bar">
! <a href=""
! id="<dtml-var base>"
! onmouseover="show_menu(event, '<dtml-var menu>');"
! onmouseout="hide_active_menu(event);"
! onclick="return false;"
! class="menu_bar"><dtml-var name capitalize></a>
</td>
</dtml-let>
</dtml-in>
--- 36,55 ----
base="name + '_base'"
menu="name + '_menu'">
<td width="20%" class="menu_bar">
! <dtml-if click_menus>
! <a href=""
! id="<dtml-var base>"
! onclick="show_menu(event, '<dtml-var menu>'); return false;"
! onmouseout="hide_active_menu(event);"
! class="menu_bar"><dtml-var name capitalize></a>
! <dtml-else>
! <a href=""
! id="<dtml-var base>"
! onmouseover="show_menu(event, '<dtml-var menu>');"
! onmouseout="hide_active_menu(event);"
! onclick="return false;"
! class="menu_bar"><dtml-var name capitalize></a>
! </dtml-if>
</td>
</dtml-let>
</dtml-in>
Index: qm/test/web/web.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/web/web.py,v
retrieving revision 1.56
diff -c -p -r1.56 web.py
*** qm/test/web/web.py 18 Dec 2002 05:30:09 -0000 1.56
--- qm/test/web/web.py 1 Jan 2003 03:35:33 -0000
*************** class QMTestPage(DefaultDtmlPage):
*** 213,226 ****
else:
edit_menu_items = self.edit_menu_items
run_menu_items = self.run_menu_items
! # Include the navigation bar.
navigation_bar = \
DefaultDtmlPage(os.path.join("test", "navigation-bar.dtml"),
file_menu_items=self.file_menu_items,
edit_menu_items=edit_menu_items,
view_menu_items=self.view_menu_items,
run_menu_items=run_menu_items,
! help_menu_items=self.help_menu_items)
return "<body>%s<br />" % navigation_bar(self.request)
else:
return "<body>"
--- 213,237 ----
else:
edit_menu_items = self.edit_menu_items
run_menu_items = self.run_menu_items
!
! # Figure out whether to use click-to-activate menus.
! click_menus = 0
! if qm.common.rc.has_option("common", "click_menus"):
! try:
! click_menus = qm.common.rc.getboolean("common",
! "click_menus")
! except ValueError:
! pass
!
! # Generate the navigation bar.
navigation_bar = \
DefaultDtmlPage(os.path.join("test", "navigation-bar.dtml"),
file_menu_items=self.file_menu_items,
edit_menu_items=edit_menu_items,
view_menu_items=self.view_menu_items,
run_menu_items=run_menu_items,
! help_menu_items=self.help_menu_items,
! click_menus = click_menus)
return "<body>%s<br />" % navigation_bar(self.request)
else:
return "<body>"
More information about the qmtest
mailing list