Re: Modules and Name space
- From: "Kevin C. Krinke" <kckrinke opendoorsoftware com>
- To: muppet <scott asofyet org>
- Cc: gtk-perl-list gnome org
- Subject: Re: Modules and Name space
- Date: Thu, 16 Sep 2004 01:52:41 -0400
On Thu, 2004-09-16 at 00:00, muppet wrote:
On Sep 15, 2004, at 11:26 PM, Kevin C. Krinke wrote:
I myself don't like the "Don't $verb" buttons because it's not really
translatable...
true. i suffer from the "everybody where i am speaks my language"
syndrome. :-/
Sad but all too often true.
I like flush_events() better as IMHO the former implies only visual
updates but I don't like flush_events() that much either. How about
something more direct then like process_pending_events()?
verbose, but accurate. still less to type than "Gtk2->main_iteration
while Gtk2->events_pending". ;-)
:)
C) either A or B but omit the Constants and/or Utils
Gtk2::Ex::Constants and Gtk2::Ex::Utils would be handy; i could see
lots of useful stuff fitting nicely into those.
So you're implying the other way around? Leave the dialogs to
Gtk2::MessageDialog and provide the Constants (minus :truth) and Utils
modules? Hmm.
yes, mostly to avoid the duplication of Gtk2::MessageDialog. i do like
the one-liners; i have my own one-liners package at work, including
things like get_open_file_name(), get_save_file_name(), get_string(),
etc. (actually implemented in C and bound to perl, but that's another
story.)
Technically these are one liners which are modules that can do just a
little bit more should you need it but not enough to make other modules
obsolete. The benefit of an objective approach in design is not having
to memorize a list of arguments per helper solution and maintain
commonly used variables for each usage. When you use these modules, pass
along the parent_window or any other option to have it be the default
for subsequent usage.
<code>
use Gtk2::Ex::Question ( parent_window => $window );
# manually set the current parent_window:
$Gtk2::Ex::Question::parent_window = $window;
if ( new_run Gtk2::Ex::Question ( text => "Yes or No?" ) ) {
new_show Gtk2::Ex::Message ( text => "Yep." );
} else {
new_show Gtk2::Ex::ErrorMsg ( text => "Not good for some reason." );
}
</code>
I'd also like to provide a grouping module, Gtk2::Extras[0], that takes
care of the default options for all modules used in OO format.
<code>
# ugly when there's more than one used, but works
#use Gtk2::Ex::Question ( %options );
#use Gtk2::Ex::Message ( %options );
# good, clean and efficient
use Gtk2::Extras ( %options );
$Gtk2::Extras::parent_window = $window;
# non-blocking popup
new_show Gtk2::Ex::Message ( text => "hash-style" );
# blocking popup
new_run Gtk2::Ex::Message ( "single argument works too :)" );
die( "A Pinky demon has torn you to shreds." )
unless new_run Gtk2::Ex::Question ( "Will you save me?" );
</code>
they're pretty simple, e.g.:
[good code]
could be implemented such that it uses a Gtk2::FileChooser if you have
support for it, etc.
I already have need for the following (which are all on my TODO list):
Choosing:
Gtk2::Ex::ChooseFile
Gtk2::Ex::ChooseDirectory
Gtk2::Ex::PickDate
Gtk2::Ex::PickTime
Druid Pages:
Gtk2::Ex::DruidPasswordPage
Gtk2::Ex::DruidApprovePage
Gtk2::Ex::DruidProgressPage
Gtk2::Ex::DruidTextPage
Splash Screens:
Gtk2::Ex::SplashScreen
Gtk2::Ex::SplashProgressText
Gtk2::Ex::SplashProgressIcons
Gtk2::Ex::SplashProgressTextIcons
I'm sure there's a ton more I or anyone else can come up with but these
are ones that I'll be needing in some way, shape or form within the next
6 months. These will all be simple and concise modules intended to be
used in as close to one liners as possible while still maintaining
decent flexibility.
Everyone is encouraged to submit their own Gnome2/Gtk2 extras in
whatever form it currently exists and I'll do my best to include the
functionality as per any discussion on the topic. Functions are
sometimes better left in Gtk2::Ex::Utils, others can probably serve us
better as objects. (Note any code submissions should be DFSG[1]
compliant.)
I expect ODS will provide a website, mailing list and bug tracking
system for this project along with submitting it to CPAN.
kck
[0] Gtk2::Extras or any other appropriate name space, I just picked it
for simplicity.
[1] Debian Free Software Guidelines
http://www.debian.org/social_contract.html#guidelines
--
Kevin C. Krinke <kckrinke opendoorsoftware com>
Open Door Software Inc.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]