Re: [pygtk] python modules/classes best practices?

2011-01-31 Thread Roberto Cavada

On 01/30/2011 11:53 PM, Robert Park wrote:

 

[...] but now that the other classes are in other files,
the module _itself_ is providing the same encapsulation that the class
was giving me, and is thus redundant.



In this perspective, you are using classes as mere namespaces of 
your functions and variables. As I said, if you do not exploit 
hierarchies and relations (and you don't as you have no inheritance 
and no polymorphism) there is very little difference between module 
and class levels (IMO there are some disadvantages with modules, see 
below).



My point with that example was not that the second version was better,
but that they were so similar that it proves that the module itself is
good enough and that I don't actually benefit from having this
particular class inside a module.



If you don't see advantages with classes, let's stay with benefits 
of having only modules. Do you see any that are not syntactic like 
number of dots between IDs and 'self' appearing as first formal param?



Indeed if your application code fits into a thousand of LOC, you can
choose whatever style you like, either having everything pushed into one
module or split into classes/packages/modules, no really matters.


Ok, but I am not arguing against all classes, just the class that
represents the graphical interface that the user interacts with.



Then I guess your GUI is necessarily very small. I cannot imagine a 
large GUI all fitted into a module, and even within one single 
class. How do you separate the GUI logics and the presentation 
layers? Can you split the GUI into (interconnected, still decoupled) 
pieces? ( someone calls them components.) If you have components, 
you can reuse/factorize code in different parts of a single 
application, or you can rearrange the GUI for another application.



have a handful of classes that represent various kinds of data that my
application uses, and that makes great sense because each class can be
instantiated multiple times and each instance represents something
meaningful.



Typically the top-level logics, controller and presentation of the 
GUI is instantiated only once, but this does not mean that it is not 
meaningful. Again, classes are not supposed to be instantiated 
multiple times.



However, if your application is intended to grow up, if you need
contracts (interfaces) to agree with other programmers, if you need to


Ok, but how does having module top-level functions instead of class
instance methods (for a class that can only be instantiated once) make
any difference?



In principle no, in practice it largely helps. I think it is trivial 
to say that the introduction of OOP did not change the software, as 
you can do whatever with a procedural-paradigm, as well as you can 
do OOP with a non-OOP language. OOPs is only for reducing 
(hopefully) costs of software.



Can you explain how module-globals make code less portable? Is there a
platform on which Python doesn't support module globals? I'm genuinely
curious.



Mmm, 'portability' was a bad term I chose, as it can create 
misunderstandings I am sorry about that. I probably had to talk 
about 'reuse'. Extending my objections, what if you wanted to have:

- threads involved
- unittests of some parts
- code generated by metaclasses at compile time
- refactoring needs, e.g. you want to move your code (or part of it) 
in a different possibly larger place.


If you have poor locality of your code, you'll get into troubles. 
Using module-level variables does not help with locality.


My two cents,
r.

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] python modules/classes best practices?

2011-01-30 Thread Roberto Cavada
Hi,

On Sat, 2011-01-29 at 23:22 -0700, Robert Park wrote:
[...]
 But I just can't shake this feeling that having a class to represent
 just the GUI when it's already inside of a module is somehow
 redundant. There will only ever be one instance of that class. What
 good is that? 

The fact that classes can be instantiated multiple times is not the
(only) reason for having classes. Inheritance and polymorphism give the
real sense to OOP - IMO - and having information hidden into hierarchies
and relations make the design easy to understand, extend, maintain, etc.

 I could just ditch the class and have all the class
 methods be top-level module function definitions, and then I could
 rename main.py into appname.py, and in my runner script, change
 this code:
 
 from appname.main import AppName
 AppName().main()
 
 into this:
 
 from appname import appname
 appname.main()

Frankly I cannot see a substantial difference in terms of quality. 
(Can you measure the quality from the number of keystrokes?) 

Indeed if your application code fits into a thousand of LOC, you can
choose whatever style you like, either having everything pushed into one
module or split into classes/packages/modules, no really matters.

However, if your application is intended to grow up, if you need
contracts (interfaces) to agree with other programmers, if you need to
decompose the application into hierarchies of functional modules, you
will very quickly end up floundering into a spaghetti nightmare if you
don't organize your code base accordingly. 

python-gtkmvc http://sourceforge.net/apps/trac/pygtkmvc/wiki may be
overkilling for toys and small applications, but drives/allows you to
split the logics and presentation layers, and to split the views and the
models into hierarchies of classes - the opposite direction you seemed
to be exploring. 

 Another reason why I care about this issue is that method invocations
 are slower when there's a period in the name, so eg calling
 self.foobar() is by definition slower than simply calling
 foobar(), so there's a minor speed boost to be had by ditching the
 class and replacing it with all module-global functions.

In python, generally, these optimizations are not very meaningful. Your
may be trying to reduce complexity of your algorithms, but one further
level of indirection and similar details make no actual difference. 

Much more important is how your code looks like (do you really exploit
the language, or do you write your code like e.g. in java?), and how
your code is organized. My personal way for evaluating python code I
write and read, is wonder if I can understand what a function does
without worrying about the details of the implementation. If not
convinced, there is certainly a better approach to make it better
(shorter, more elegant, more readable). 

 One thing I changed recently that got me thinking about this is that I
 changed GtkBuilder from being an instance variable to a top-level
 module variable. 

Sometimes I use aliases like you, especially in loops where it makes
sense, but only if the alias is kept local and close to the place where
it is used. However, introducing aliases makes the code harder to
understand, and if the alias is global to the module (like in your
example) the code is less portable/usable prone to errors. 

r.


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] [ANNOUNCE] python-gtkmvc 1.99.1

2010-12-30 Thread Roberto Cavada
 could cause the wrong
methods to be called on all but the last instance created. This
did not affect programs that only use the built-in list type.

  - Mutable instances that used to be assigned to properties would
notify of their changes even after being replaced in the model.

  - No more errors from static container adapters you didn't create.

  - Multiple concurrent iterators on views no longer steal each other
widgets.


Many thanks to Christian Spoer for narrowing down a bug and to Tobias
Weber for joining the team.

--
Roberto Cavada

PA HREF=http://pygtkmvc.sourceforge.net;pygtkmvc 1.99.1/A -
Pygtk MVC is a thin, multiplatform framework that helps to design
and develop GUI applications based on the PyGTK toolkit. (30-Dec-10)


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Splitting things up

2010-06-28 Thread Roberto Cavada
Il 06/28/2010 10:54 AM, Elver Loho ha scritto:

 Is there a good design solution for splitting the window controller

 into multiple chunks?


You may have a look to gtkmvc:
http://sourceforge.net/apps/trac/pygtkmvc/wiki
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] ANN: PyGUI 2.1

2009-11-17 Thread Roberto Cavada
Greg Ewing wrote:

 What is the general feeling out there? 


About the announcements policy, I wonder what is the difference with 
other projects which use or extend pygtk. I suspect the difference 
is that pygui is perceived like a potential competitor of pygtk, so 
announcements about it are told to be not welcomed (especially if 
you also state that pygtk sucks :)

If my feeling is correct, then I cannot go along with the policy of 
not allowing announcements of such projects - simply because it is 
not clear to me where the line separating pygtk users and pygtk 
competitors can be collocated.

Furthermore, I do think that competitors should be welcomed as they 
may contribute to improve the quality of pygtk itself.

Finally, let me say that if you think pygtk could be improved (to 
put it in polite terms), you have to justify your statement, or else 
they have no meaning at all. Notice that a true analysis may give a 
sense to your project as well.

r.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Install pyGtk on Solaris 10

2009-05-13 Thread Roberto Cavada
David Miller wrote:

 configure:20521: gcc -o conftest -g -O2 -mt -I/usr/include/gtk-2.0 
[...]

 cc1: error: invalid option `t'

I guess that option -mt is interpreted as: -m -t (as -m does not 
take any argument).

Is 'gcc' *gnu* gcc, or what else?
r.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] automagical glade

2009-04-15 Thread Roberto Cavada
Chris Camacho wrote:

 All widgets are mapped to a user interface object via their glade id and 
 so they can be accessed like this...
 ui.entry1.set_text(hello world)

Actually i like the idea. I think I'll consider it for the View part 
of gtkmvc, instead of having view['entry1'].set_text having 
view.entry1.set_text is much better.

Thanks,
  r.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] [ANNOUNCE] python-gtkmvc 1.99.0

2009-04-01 Thread Roberto Cavada
Version 1.99.0 of pygtkmvc has been released. 

Project homepage:
http://apps.sourceforge.net/trac/pygtkmvc/wiki

Download:
http://sourceforge.net/projects/pygtkmvc/


==
About pygtkmvc
==

pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the PyGTK2
toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application, from their representation.

The Observer pattern helps to weaken dependencies among parts that
should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure to
help designing and implement GUI applications based on the MVC and
Observer patterns.

The framework has been designed to be:

* Essential and small, it does only what it was designed for.
* Not an external dependency for your application: it fits in
   80KB and can be released along with it.
* Easy to understand and to use; fully documented.
* Portable: straightly runs under many platforms.

License: LGPL


About release 1.99.0


Released version 1.99.0

This is a major release that breaks backward compatibility with the
1.2 family.

Also, this version is not stable yet, as there might be some changes
in the forthcoming releases toward version 2.0.0.

* New features
  Features 1 and 2 cause this version to be no backward compatible.
  
  1. View's constructor no longer takes a controller.

  2. Controller's constructor takes a view.
 This allows (together with 1.) to have multiple controllers
 controlling a shared view, making possible to decompose
 controllers (see the website for details)

  3. Support for SQLObject (support for SQLAlchemy delayed to 1.99.1)

  4. Support for custom observable properties in Models.
 Now it is possible to define observable properties whose values
 are stored outside the model, in a DB, a file, a network, etc.

  5. New syntax for defining observable properties.
 Now class attributes are used as in common ORMs.

  6. Explicit declaration of observing methods into observer through
 decorators.

  7. Views have attributes 'glade' and 'top' to simplify their
 construction.

  8. gtkmvc has now its own logging system that users can set when
 required. Previous naive prints have been removed. 

* Documentation
  1. New website
  2. New Quick Start Guide
  
* Refactoring, Bug fixes
  1. Improved performances
  2. Cleaned up View construction, that is now much more simple
  3. Fixed a row of minor bugs

Thanks to those who provided feedback and bug reports.
In particular, to:

Henrik Bohre henrik TOD bohre TA gmail TOD com
Joel Cross
Alessandro Dentella sandro TA e-den TOD it
Christopher Groskopf cgroskop TA calpoly TOD edu

--
Roberto Cavada roboogle TA gmail TOD com

PA HREF=http://pygtkmvc.sourceforge.net;pygtkmvc 1.99.0/A -
Pygtk MVC is a thin, multiplatform framework that helps to design
and develop GUI applications based on the PyGTK toolkit. (01-Apr-09)

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Hi, all! I'm new to the list. How can I create please a frontend for a TUI command?

2008-10-28 Thread Roberto Cavada
NĂ©stor Amigo Cairo wrote:

 Ok! I have tested this, and it only works at the end of the execution
 of the command, 

There is a problem in the way you create your watcher's callback. 
You have to use a function, a method or a lambda. Try with this 
version of 'do_format'. It will also handle pipe error conditions.
#---
   def do_format(self, widget, textbuffer):

 def watcher(source, condition, buf):
   if condition == gobject.IO_IN:
 buf.insert(buf.get_end_iter(), source.readline())
 return True # keep it watching
   # error condition
   buf.insert(buf.get_end_iter(), process died\n)
   return False # stop watching

 proc = subprocess.Popen((./prueba.sh),
 shell=False,
 stdout=subprocess.PIPE,
)
 gobject.io_add_watch(proc.stdout,
  gobject.IO_IN | gobject.IO_ERR | 
gobject.IO_HUP,
  watcher, textbuffer)
 return
#---

Hope that helps.
r.


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] [ANNOUNCE] pygtkmvc release 1.2.2

2008-08-26 Thread Roberto Cavada
Version 1.2.2 of pygtkmvc has been released.

Project homepage:
http://pygtkmvc.sourceforge.net

Download:
http://sourceforge.net/projects/pygtkmvc/


==
About pygtkmvc
==

pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the PyGTK2
toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application, from their representation.

The Observer pattern helps to weaken dependencies among parts that
should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure to
help designing and implement GUI applications based on the MVC and
Observer patterns.

The framework has been designed to be:

* Essential and small, it does only what it was designed for.
* Not an external dependency for your application: it fits in
   80KB and can be released along with it.
* Easy to understand and to use; fully documented.
* Portable: straightly runs under many platforms.

License: LGPL

===
About release 1.2.2
===

This is a minor release that fixes two major bugs about adapters.
A few new examples about adapters have been also added.

Thanks to Alessandro Dentella sandro TA e-den TOD it for reporting 
both bugs.


--
Roberto Cavada roboogle TA gmail TOD com
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Installing PyGTK on solaris 8

2008-07-09 Thread Roberto Cavada

Shalom Kramer wrote:

*** The test program failed to compile or link. See the file config.log 
for the
*** exact error that occurred . This usually means GLIB is incorrectly 
installe


Have you followed the suggestion?
r.

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Mailing list of gtkmvc

2008-04-17 Thread Roberto Cavada

Hi all,
  my apologies to whom may be not interested in the following.

gtkmvc - MVC and Observer patterns for pygtk 
(http://pygtkmvc.sourceforge.net/index.php) has today a user mailing 
list by popular demand.


The idea is to have a shared discussion area for all users, to 
collect feedback and issues from all interested users in order to 
prepare next releases. New family 2.x is close to be released and 
will provide support for the integration with ORMS like SQLObject on 
the Model side. On the View side adding support for UIManager and 
Builder is under evaluation.


To subscribe simply go to 
https://lists.sourceforge.net/lists/listinfo/pygtkmvc-users


Hope you all will join.
Cheers,
 r.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Installing PyGTK on solaris 8

2007-11-29 Thread Roberto Cavada

Shalom Kramer wrote:

Yes, the file indicates that there is a problem with compiling GTK 
programs, not that I can understand why. 



If you wish to get any help here, you should post the (selected) 
contextualized error message you get from configure, in config.log. 
(You are not requested to report the reasons for a problem, but you 
are expected to report at least the symptoms.)


r.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANNOUNCE: pygtkmvc-1.2.1 has been released

2007-10-17 Thread Roberto Cavada
Version 1.2.1 of pygtkmvc has been released.

Project homepage:
http://pygtkmvc.sourceforge.net

Download:
http://sourceforge.net/projects/pygtkmvc/


==
About pygtkmvc
==

pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the PyGTK2
toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application, from their representation.

The Observer pattern helps to weaken dependencies among parts that
should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure to
help designing and implement GUI applications based on the MVC and
Observer patterns.

The framework has been designed to be:

* Essential and small, it does only what it was designed for.
* Not an external dependency for your application: it fits in
  80KB and can be released along with it.
* Easy to understand and to use; fully documented.
* Portable: straightly runs under many platforms.

License: LGPL

===
About release 1.2.1
===

This is a minor release that fixes a bug.
Thanks to Roman Dobosz gryf TA elysium TOD pl for catching it.
With respect to version 1.0.1, new version 1.2 provides:

* New features:
  - Added adapters, new entities that largely simplify and reduce
costs and development efforts. Adapters handles autonomous
coordination between properties into models and widgets into
views. Roughly speaking, an adapter keeps aligned some part of
the model and a widget in a transparent and still customizable
way.

  - Added script gtkmvc-progen that aids developers in generating
gtkmvc-based projects from scratch. gtkmvc-progen can be run in
both batch and GUI modalities. For example:
$ gtkmvc-progen name=myproj author=Wil Shakespeare gui=no

... generates project myproj in batch mode. See the user
manual for a full list of available options.

* Other changes
  - Spurious value changes in observable properties are no longer
notified by default. A new optional parameter of class Observer
allows for a backward-compatible semantics.

  - Widgets search into Views has been optimized.

  - Bug fixes and optimizations. 
o Undefined handlers for custom widgets are correctly
  managed. Thanks to Allan Douglas zalguod TA 
  users TOD sourceforge TOD net for providing a working patch.

o Fixed a subtle bug in the observer pattern implementation.

o A few other minor fixes and optimizations. 

-- 
Roberto Cavada roboogle TA gmail TOD com

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANNOUNCE: pygtkmvc-1.2.0 has been released

2007-10-14 Thread Roberto Cavada
Version 1.2.0 of pygtkmvc has been released.

Project homepage:
http://pygtkmvc.sourceforge.net

Download:
http://sourceforge.net/projects/pygtkmvc/


==
About pygtkmvc
==

pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the PyGTK2
toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application, from their representation.

The Observer pattern helps to weaken dependencies among parts that
should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure to
help designing and implement GUI applications based on the MVC and
Observer patterns. Features

The framework has been designed to be:

* Essential and small, it does only what it was designed for.
* Not an external dependency for your application: it fits in
  80KB and can be released along with it.
* Easy to understand and to use; fully documented.
* Portable: straightly runs under many platforms.


===
About release 1.2.0
===

This is a major release that brings some important new features 
and a few bug fixes. 

* New features:
  - Added adapters, new entities that largely simplify and reduce
costs and development efforts. Adapters handles autonomous
coordination between properties into models and widgets into
views. Roughly speaking, an adapter keeps aligned some part of
the model and a widget in a transparent and still customizable
way.

  - Added script gtkmvc-progen that aids developers in generating
gtkmvc-based projects from scratch. gtkmvc-progen can be run in
both batch and GUI modalities. For example:
$ gtkmvc-progen name=myproj author=Wil Shakespeare gui=no

... generates project myproj in batch mode. See the user
manual for a full list of available options.

* Other changes
  - Spurious value changes in observable properties are no longer
notified by default. A new optional parameter of class Observer
allows for a backward-compatible semantics.

  - Widgets search into Views has been optimized.

  - Bug fixes and optimizations. 
o Undefined handlers for custom widgets are correctly
  managed. Thanks to Allan Douglas zalguod at
  users.sourceforge.net for providing a working patch.

o Fixed a subtle bug in the observer pattern implementation.

o A few other minor fixes and optimizations. 

-- 
Roberto Cavada roboogle AT gmail.com


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANNOUNCE: pygtkmvc-1.0.1 has been released

2007-05-22 Thread Roberto Cavada

Version 1.0.1 of pygtkmvc has been released.

pygtkmvc can be download from the project homepage:
http://pygtkmvc.sourceforge.net

==
About pygtkmvc
==

pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the PyGTK2
toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application, from their representation.

The Observer pattern helps to weaken dependencies among parts that
should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure to
help designing and implement GUI applications based on the MVC and
Observer patterns. Features

The framework has been designed to be:

* Essential and small, it does only what it was designed for.
* Not an external dependency for your application: it fits in
80KB and can be released along with it.
* Easy to understand and to use; fully documented.
* Portable: straightly runs under many platforms.


===
About release 1.0.1
===

This is a minor release that mainly features a few bug fixes.

* New features:
- Custom widgets into glade file are now supported by views.

* Bug fixes:
- Fixed access to properties in multi-threading models.
- Fixed a bug in the observable properties registration mechanism.

* Many thanks to:
- Guillaume Libersat glibersat AT linux62.org for providing a
patch that enable reading custom widgets from glade files.
- Phillip Calvin phillipc AT toasterlogic.com and Andreas
Poisel ap AT automatisch.cc for reporting bugs.
- Jeffrey Barish jeff_barish AT earthlink.net for providing
feedback.
- Kartik Mistry kartik.mistry AT gmail.com for his work on
Debian package.

--
ITC - dall'1 marzo 2007 Fondazione Bruno Kessler
ITC - since 1 March 2007 Fondazione Bruno Kessler
--
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Gnome-CRITICAL message

2007-03-23 Thread Roberto Cavada

Pascal Duchatelle wrote:

I get the following messages (which I do not understand) :
(essai.py:3486): Gnome-CRITICAL **: gnome_program_get_app_id: assertion
Is there any possibility that a glade file refers to any gnome 
widget, or the project type is gnome when you do not have gnome 
installed?


r.

--
ITC - dall'1 marzo 2007 Fondazione Bruno Kessler
ITC - since 1 March 2007 Fondazione Bruno Kessler
--
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] pygtkmvc version 1.0.0 has been released

2006-12-26 Thread Roberto Cavada

Hi all,

  I'm proud to announce that the first stable release
1.0.0 of pygtkmvc has been released.


**   pygtkmvc version 1.0.0   **


pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the
PyGTK2 toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application from their representation.

The Observer pattern helps to weaken dependencies among parts
that should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure
to help designing and implement GUI applications based on
the MVC and Observer patterns.



** Features   **


The framework has been designed to be:
- Essential and small, it does only what it was designed for.
- Not an external dependency for your application: it fits
  in 80KB and can be released along with it.
- Easy to understand and to use; fully documented.
- Portable: straightly runs under many platforms.

Version 1.0.0 is the first stable release. Main features are:

- Observer pattern supports pythonian containers and user-defined
  classes.
- Support for multi-threading in models.
- Support for gtk models like TreeModel and TextBuffer.
- Bug fixes.
- Documentation and several examples are provided.



**  Get it!   **


Latest version and information can be found at the
project home page: http://pygtkmvc.sourceforge.net

License is LGPL.



**  Credits   **


Many thanks to:
- Baruch Even baruch _AT_ ev-en.org
  for providing useful feedback and a pretty example.
- Johannes Jordens j.jordens _AT_ ucl.ac.uk and
  Robert Jordens jordens _AT_ debian.org
  for depeloping and maintaining Debian packages.

--
Roberto Cavada
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] pygtkmvc version 1.0.0 has been released

2006-12-21 Thread Roberto Cavada

Hi all,

  I'm proud to announce that the first stable release
1.0.0 of pygtkmvc has been released.


**   pygtkmvc version 1.0.0   **


pygtkmvc is a fully Python-based implementation of the
Model-View-Controller (MVC) and Observer patterns for the
PyGTK2 toolkit.

MVC is a pattern that can be successfully used to design and
develop well structured GUI applications. The MVC pattern
basically helps in separating semantics and data of the
application from their representation.

The Observer pattern helps to weaken dependencies among parts
that should be separated, but need to be connected each other.

pygtkmvc provides a powerful and still simple infrastructure
to help designing and implement GUI applications based on
the MVC and Observer patterns.



** Features   **


The framework has been designed to be:
- Essential and small, it does only what it was designed for.
- Not an external dependency for your application: it fits
  in 80KB and can be released along with it.
- Easy to understand and to use; fully documented.
- Portable: straightly runs under many platforms.

Version 1.0.0 is the first stable release. Main features are:

- Observer pattern supports pythonian containers and user-defined
  classes.
- Support for multi-threading in models.
- Support for gtk models like TreeModel and TextBuffer.
- Bug fixes.
- Documentation and several examples are provided.



**  Get it!   **


Latest version and information can be found at the
project home page: http://pygtkmvc.sourceforge.net

License is LGPL.



**  Credits   **


Many thanks to:
- Baruch Even baruch _AT_ ev-en.org
  for providing useful feedback and a pretty example.
- Johannes Jordens j.jordens _AT_ ucl.ac.uk and
  Robert Jordens jordens _AT_ debian.org
  for depeloping and maintaining Debian packages.

--
Roberto Cavada
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Treeview space between columns

2005-07-27 Thread Roberto Cavada
(I apologie if you receive multiple copies of this message)

Hi, 
 I noticed that there is always a space around columns in treeviews,
even when both the style properties 'GtkTreeView::vertical-separator'
and 'GtkTreeView::horizontal-separator' are set to 0. 

E.g. look at the screenshot at
http://sra.itc.it/people/cavada/images/Screenshot-window1.png

In the example, columns 0 is text, and columns 1 and 2 are filled by a
rectangular (red) image that is intended to fulfill the cell. However,
as you can see there is a 1-pixel space all around each cell. 

What I'd like to implement is a treeview showing waveforms. The columns
data are images that must stay attached each other in a row, without any
space between them. When composed appropriately, a row of images would
appear as a waveform. 

Did you happen to know whether it is possible to remove the space around
the columns?

Many thanks, 
 rob

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Simple TreeView API

2004-10-06 Thread Roberto Cavada
On Wed, 2004-10-06 at 23:10 +1300, John C Barstow wrote:
 ANY feedback would be helpful

I have no technical feedback to provide, actually. 
Anyway, I want to stress that those who I talk about pygtk will always
complain about the convolution of tree/list widgets it provides. 
Powerful, elegant, clever and whatever, but too complicated to begin
with. 

One would expect to see an abstraction layer *within* pygtk, that's the
point as for me. 
rob


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] gtkmvc (was: pygtk + glade: code decomposition best practices?)

2004-10-01 Thread Roberto Cavada
On Thu, 2004-09-30 at 13:51 -0400, Brett Viren wrote:
 I want it to trigger an XML-RPC call to set the something parameter
 on the server.  I've implemented MyModel.__setattr__() to do this
 interception and from there pass the call along to the parent by
 calling Model.__setattr__().
 
 This seems to work, but is it the best way?  For example, in the end
 my __setattr__ will have a big list of if blocks, one for each
 intercepted property which isn't so pretty.
It is not obvious to decide here. You might think to keep your solution,
maximizing locality of the handling code, that is not necessarily a bad
idea. From one hand, the code might become bigger and bigger, but the
locality of the comunication with the server might improve code
inspection, bug fixing, commitment of new code, etc.  

From the other hand, there is the necessity of catching modification on
the server's data. How the view/controller pair would be notified of
this modification? What happens whether other data that depend on the
changed one must be updated? 

In my opinion everytime you have mutual dependencies between data,
bidirectional data flows, and need for separation of model and data
representation, you might think to consider the use of mvc and observer
patterns. 

I am not sure gtkmvc would capture all requirements in your case, since
it forces you to put notification about observable properties in
separate class methods. 

Actually, if you were able to adapt the metaclass that generates the
code that implements the observer pattern, you might think to make the
model comunicate with the server via RPC for free, since the
comunication code would be generated as well. This would be possible
only if the function that maps model's data to server's data were
injective. Under the necessary condition, it is a matter of deriving a
new metaclass from the one that gtkmvc.model.Model currently uses. 

Feel free to ask for further details, maybe out of this list since I
think this is going OT. 
rob

-- 
  _/_/_/   _/_/_/   Roberto Cavada
 _/   _/ _/ITC-irst   http://www.irst.itc.it
_/   _/ _/Automated Reasoning Systems - Formal Methods Group
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy
   _/  _/   Tel: +39 0461 314 328   Fax: +39 0461 302 040
_/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] pygtk + glade: code decomposition best practices?

2004-09-30 Thread Roberto Cavada
On Thu, 2004-09-30 at 13:18 +0300, Ruslan wrote:
 I would like to ask people using pygtk + glade to share their approach
 on code decomposition. 
I use a mvc+observer pattern from my gtkmvc (see
http://sra.itc.it/people/cavada/mvc). Each pair controller+view can be
associated to a separate glade file, or to a set of subtrees of one or
more glade trees. In my opinion this approach helps a lot in separating
the different parts of a GUI. The model(s) can also be splitted, so
obtaining good a separation of the application logic as well. 
rob

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] ANNOUNCE: PyScintilla-1.99.4 released

2004-08-23 Thread Roberto Cavada
On Fri, 2004-08-20 at 15:17 -0300, Christian Robottom Reis wrote:
 On Wed, Aug 18, 2004 at 04:05:29PM +0200, Roberto Cavada wrote:
  What is new
  ---
  With respect to previous versions, PyScintilla-1.99.4:
  - is a stand-alone module, no longer based on GtkScintilla. 
 
 This is excellent news. Does it implement all the syntax highlighting in
 itself then?
All lexers should be embedded in the scintilla's library. Actually their
are both on my linux box, and on the binary distribution I prepared for
MS Windows. 

Underneath there is a short example of syntax hl + folding.
A screenshot of the running example can be found at:
http://sra.itc.it/people/cavada/images/Screenshot-Syntax_hl.png

Most of the code deals with the setting of properties and colours. 
rob


# -- CODE STARTS HERE -- #
import gtk
import scintilla

def set_syntax_hl(sci):
sci.SetLexer(scintilla.SCLEX_PYTHON)

# sets attributes:
sci.SetKeyWords(0, return for while class def import self  \
pass try except finally)

fore_cols = ((scintilla.SCE_P_COMMENTLINE, 0xa0),
 (scintilla.SCE_P_TRIPLEDOUBLE, 0xA05080),
 (scintilla.SCE_P_STRING, 0xA000A0),
 (scintilla.SCE_P_CLASSNAME, 0x008cdc),
 (scintilla.SCE_P_DEFNAME, 0x007000),
 (scintilla.SCE_P_WORD, 0xA0))

for fore in fore_cols: sci.StyleSetFore(*fore)

# other settings:
sci.StyleSetSize(scintilla.SCE_P_TRIPLEDOUBLE, 9)
sci.StyleSetBold(scintilla.SCE_P_DEFNAME, 1)
sci.StyleSetBold(scintilla.SCE_P_WORD, 2)
sci.StyleSetUnderline(scintilla.SCE_P_WORD, 1)
sci.StyleSetFont(scintilla.SCE_P_WORD, !courier)
sci.StyleSetSize(scintilla.SCE_P_WORD, 10)
return


def set_folding(sci):
sci.SetProperty(fold, 1)
sci.SetMarginWidthN(2, 20)
sci.SetMarginMaskN(2, scintilla.SC_MASK_FOLDERS)
sci.SetMarginSensitiveN(2, 1)
sci.SetFoldFlags(16)
sci.SetIndentationGuides(1)
sci.SetTabIndents(1)
sci.SetIndent(3)

mdefs = ((scintilla.SC_MARKNUM_FOLDER, scintilla.SC_MARK_PLUS),
 (scintilla.SC_MARKNUM_FOLDEROPEN, scintilla.SC_MARK_MINUS),
 (scintilla.SC_MARKNUM_FOLDERSUB, scintilla.SC_MARK_EMPTY),
 (scintilla.SC_MARKNUM_FOLDERTAIL, scintilla.SC_MARK_EMPTY),
 (scintilla.SC_MARKNUM_FOLDEREND, scintilla.SC_MARK_EMPTY),
 (scintilla.SC_MARKNUM_FOLDERMIDTAIL, scintilla.
SC_MARK_EMPTY),
 (scintilla.SC_MARKNUM_FOLDEROPENMID, scintilla.
SC_MARK_EMPTY))

for mdef in mdefs: sci.MarkerDefine(*mdef)
return

def margin_click(sci, modifiers, position, margin):
Callback from signal MarginClick
if margin == 2:
line = sci.LineFromPosition(position)
sci.ToggleFold(line)
pass
return


def main():
w = gtk.Window()
w.set_size_request(200,300)
s = scintilla.Scintilla()
w.add(s)

set_syntax_hl(s)
set_folding(s)

s.connect(MarginClick, margin_click)
w.connect(destroy, gtk.mainquit)

w.show_all()
gtk.mainloop()
return


if __name__ == __main__: main()
# -- CODE ENDS HERE -- #


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANNOUNCE: PyScintilla-1.99.4 released

2004-08-18 Thread Roberto Cavada
I am very happy to announce a new release of PyScintilla, version
1.99.4.

What is PyScintilla
---
PyScintilla is a Python wrapper for Scintilla, a powerful text editing
component. PyScintilla is based on PyGTK-2. 


What is new
---
With respect to previous versions, PyScintilla-1.99.4:
- is a stand-alone module, no longer based on GtkScintilla. 
- provides an installer for Windows' users


What is still missing
-
To reach version 2.0, PyScintilla still needs:
- Testing
- Documentation
- Examples
- Implementation for methods AddStyledText, FindText, 
  FormatRange, GetStyledText, and GetTextRange
- Decision about names of methods, signals and constants.


Download

PyScintilla can be reached at this URL:
http://sra.itc.it/people/cavada/PyScintilla2.html


-- 
  _/_/_/   _/_/_/   Roberto Cavada
 _/   _/ _/ITC-irst   http://www.irst.itc.it
_/   _/ _/Automated Reasoning Systems - Formal Methods Group
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy
   _/  _/   Tel: +39 0461 314 328   Fax: +39 0461 302 040
_/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] Released gtkmvc version 0.9.1

2004-06-11 Thread Roberto Cavada
MVC Framework version 0.9.1 released. 

MVC is an implementation of the Model-View-Controller and Observer
patterns for the Pygtk2 toolkit. MVC is a pattern that can be
successfully used to design and develop well structured GUI
applications. 

This is a minor release, that adds a tutorial that should help users to
quickly understand whether gtkmvc can fit their needs or not. 

Latest version and information can be found at this URL:
http://sra.itc.it/people/cavada/mvc/index.html

The tutorial can be reached at:
http://sra.itc.it/people/cavada/mvc/docs/tutorial/html/tutorial.html

Regards, 
 Roberto


-- 
  _/_/_/   _/_/_/   Roberto Cavada   
 _/   _/ _/ITC-irst   http://www.irst.itc.it 
_/   _/ _/Automated Reasoning Systems - Formal Methods Group 
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy 
   _/  _/   Tel: +39 0461 314 328   Fax: +39 0461 302 040
_/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] [ANN] MVC-0.3.0 released

2004-01-15 Thread Roberto Cavada
Hi all, 
  thanks for the feedback. 

Links should be working now. 

On Thu, 2004-01-15 at 09:29, Ionutz Borcoman wrote:
 1. Put somewhere a 'road-map' of the project. 
Yes, I agree. 
Project is tagged 0.3.0 just for missing stuff like this.
Let me make it clearer. 
As for our project's needs, features are mature enough. 
As you said, what is still missing is:
- packaging issues
- installation
- webpage (with working links!)

Thanks you very much for the code you supplied. I will integrate it in
the next coming release. 
Depending on the feedback I'll receive, next release could be tagged 1.0
rob

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] [ANN] MVC-0.3.0 released

2004-01-15 Thread Roberto Cavada
On Thu, 2004-01-15 at 09:49, Roberto Cavada wrote:
 Thanks you very much for the code you supplied. I will integrate it in
 the next coming release. 
I released version 0.9.0. 

What's new:
- changed the module name from 'mvc' to 'gtkmvc'
- integrated setup.py for installation
- restructured the package
- changed version to 0.9.0 to make people feeling more 
  confident of it ;)

No, really what was missing was the setup process. 
I thank again Ionutz for his support in that sense. 
Furthermore, what still misses to make it a final release is:
1. some feedback from other real testbeds 
2. complete doc of source code

rob


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] MVC-0.3.0 released

2004-01-14 Thread Roberto Cavada
MVC Framework version 0.3.0 released. 

MVC is an implementation of the Model-View-Controller and Observer
patterns for the Pygtk2 toolkit. MVC is a pattern that can be
successfully used to design and develop well structured GUI
applications. 

The MVC pattern basically helps in separating sematics and data of the
application, from their representation. The Observer pattern is also
embedded here. This pattern allows making separated parts independent,
but still connected each other. 

About this implementation:
- easy to understand and to use
- makes code extremely easy to write and read
- fully documented
- straightly runs under many platforms (unixes, windows, solaris,
  etc.)
- essential, it does only what it was designed for

Latest version and information can be found at this URL:
http://sra.itc.it/people/cavada/mvc/index.html

Rob

-- 
  _/_/_/   _/_/_/   Roberto Cavada   
 _/   _/ _/ITC-irst   http://www.irst.itc.it 
_/   _/ _/Automated Reasoning Systems - Formal Methods Group 
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy 
   _/  _/   Tel: +39 0461 314 328   Fax: +39 0461 302 040
_/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] ANN: mvc 0.2.1 released

2003-07-23 Thread Roberto Cavada
A simple Model-View-Controller framework for pygtk2. 
Also, implements the Observer pattern. 

With respect to the previous version, this version provides:
1. Observable properties are simple python class' properties (via
metaclasses)
2. Every class can be an Observer for a model
3. Up-to-date docs and a simple example

The latest version can be found here:
http://sra.itc.it/people/cavada/dload/mvc-0.2.1.tar.gz

rob

-- 
  _/_/_/   _/_/_/   Roberto Cavada   
 _/   _/ _/ITC-irst   http://www.irst.itc.it 
_/   _/ _/Automated Reasoning Systems - Formal Methods Group 
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy 
   _/  _/   Tel: +39 0461 314 328   Fax: +39 0461 302 040
_/   _/_/  cavada#irst.itc.it   http://sra.itc.it/people/cavada


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] PyScintilla2 version 1.99.2 released

2003-03-20 Thread Roberto Cavada
Hi all PyGTK list members,

PyScintilla2-1.99.2 has been released.

You can find second released version of PyScintilla2 at 
http://sra.itc.it/people/cavada/PyScintilla2.html.
License is LGPL.

Best regards,
 rob
---
What's new?
These (mandatory) methods were missing in first version 1.99.1:
get_text, get_sel_text, get_line, get_cur_line
What's that?
Scintilla is a powerful, multi-platform, general purpose editing widget, 
developed by Neil Hodgson.

Michele Campeotto realized a binding for pygtk-0.6.5, named 
PyGtkScintilla. Since there was not support for GTK2, I developed 
PyScintilla2 from scratch, by using GtkScintilla2.

GtkScintilla2 is a Scintilla widget for GTK2, developed and maintained 
by Dennis J Houy [EMAIL PROTECTED].



--
 _/_/_/   _/_/_/   Roberto Cavada
_/   _/ _/ITC-irst   http://www.irst.itc.it
_/   _/ _/Automated Reasoning Systems - Formal Methods Group
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy
  _/  _/   Tel: +39 0461 314 321   Fax: +39 0461 302 040
   _/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] [ANN] PyScintilla2 version 1.99.1 released

2003-03-11 Thread Roberto Cavada
Hi all PyGTK list members,

 PyScintilla2 is the Scintilla binding for pygtk-2.0.

This is a beta, so if you find problems, or if you can provide useful 
feedback, please do not hesitate to contact me.

You can find PyScintilla2 at 
http://sra.itc.it/people/cavada/PyScintilla2.html.
License is LGPL.

Best regards,

  rob

---
What's that?
Scintilla is a powerful, multi-platform, general purpose editing 
widget, developed by Neil Hodgson.

Michele Campeotto realized a binding for pygtk-0.6.5, named 
PyGtkScintilla. Since there was not support for GTK2, I developed 
PyScintilla2 from scratch, by using GtkScintilla2.

GtkScintilla2 is a Scintilla widget for GTK2, developed and maintained 
by Dennis J Houy [EMAIL PROTECTED].



--
  _/_/_/   _/_/_/   Roberto Cavada
 _/   _/ _/ITC-irst   http://www.irst.itc.it
_/   _/ _/Automated Reasoning Systems - Formal Methods Group
/_/_/  _/Via Sommarive, 18 - 38050 Povo (TN) - Italy
   _/  _/   Tel: +39 0461 314 321   Fax: +39 0461 302 040
_/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] PyScintilla wrapper [WAS: Porting of wrapper from pygtk1 to pygtk2]

2003-02-21 Thread Roberto Cavada
Roberto Cavada wrote:
   I am currently trying to port the python wrapper for a gtk
   widget (gtkscintilla2).

I got it!
As soon as I get the time to provide some missing code, as well as 
configuration/building stuff, I'll release PyScintilla-1.99.0.
rob

--
(What follows a report that might be useful in the future for other 
users. Also, contains suggestion about possible improvement of codegen).

Generated code imports from gtk the widget base class, for Scintilla 
the gtk.Frame type:

_PyGtkFrame_Type = (PyTypeObject *)PyDict_GetItemString(moddict,
  Frame);

Where 'moddict' is of course the gtk module.
Notice that this function does not raise an exception if the given key 
is not found in the dictionary. In this case returned value is simply 
NULL.

* My claim here is that codegen should generate code to check the 
returned value, and if this is NULL, to raise an exception. *


Returned value is used when registering the widget class, as base type:

pygobject_register_class(d, GtkScintilla, GTK_TYPE_SCINTILLA,
  PyGtkScintilla_Type, Py_BuildValue((O), PyGtkFrame_Type));


Again, notice that Py_BuildValue assumes that if the given object is 
NULL, an error occurred before it is called, so the corresponding 
exception has been already handled.
Python documentation states that in this case it returns NULL, without 
raising an exception. Moreover, if there are not previously set 
exceptions, it sets PyExc_SystemError.


IN CONCLUSION:
If - as happened in my case - someone specifies a wrong name for the 
base class type in the override file, the resulting (wrong) behaviour 
can be really hard to understand.

To complete the report, this was the wrong line in the 
scintilla.override file:
  import gtk.GtkFrame as PyGtkFrame_Type

The fixed version is obviously:
  import gtk.Frame as PyGtkFrame_Type


rob

--
--
Roberto Cavada
ITC-irst Institute for Scientific and Technological Research
Automated Reasoning Systems - Formal Methods Group
Via Sommarive, 18 - 38050 Povo (TN) - Italy
Tel: +39 0461 314 321   Fax: +39 0461 302 040
[EMAIL PROTECTED]  http://sra.itc.it/people/cavada/
--

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Porting of wrapper from pygtk1 to pygtk2

2003-02-18 Thread Roberto Cavada
Hi all,
  I am currently trying to port the python wrapper for a gtk widget 
(gtkscintilla2).

*** SOME CONTEXT:
Original wrapper works with pygtk1 (say 'W1').

Since the gtk widget is now available for gtk2, I am trying to modify 
W1 in order to make it working with pygtk2 (say 'W2').

I have to say I am not sure about the result, since I am not as much 
familiar with pygtk c-side as I'd like, and in general with gtk. In 
particular in W1 I found many references to functions PyGtk_{New, Get, 
Type}, defined by pygtk.h.

In W2 pygtk.h does no longer export like that functions. Instead, 
pygobject.h exports similar functions, and I tried to guess the 
matching as follows (don't know if this is correct):

#define PyGtk_New   pygobject_new
#define PyGtk_Get   pygobject_get
#define PyGtk_Type  PyGPointer_Type



*** THE PROBLEM:
W2 initialization code simply calls init_pygtk().
After initialization, every time W2's code calls PyGtk_New 
(=pygobject_new) a segfault occurs.

Don't know if I provided information enough, but can someone 
understand what am I missing?

More in general, there exist documents or tutorials that explain how 
to build pygtk wrappers for gtk widgets?

Thank you,
 roberto

--
--
Roberto Cavada
ITC-irst Institute for Scientific and Technological Research
Automated Reasoning Systems - Formal Methods Group
Via Sommarive, 18 - 38050 Povo (TN) - Italy
Tel: +39 0461 314 321   Fax: +39 0461 302 040
[EMAIL PROTECTED]  http://sra.itc.it/people/cavada/
--

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Cannot find get_state() in pygtk2

2003-01-29 Thread Roberto Cavada
I need to retrieve sensitive state of a widget.
FAQ states I can use the get_state() method, but unfortunately I could 
not find any trace about that method, in my pygtk installation.

 import gtk
 w = gtk.Window()
 w.get_state()
Traceback (most recent call last):
  File stdin, line 1, in ?
AttributeError: 'gtk.Window' object has no attribute 'get_state'

Probably this is due to my configuration, pygtk is 1.99.14.

About get_state(), code generator produces only the following warning 
during the building phase. This does not seem connected to the 
problem, though:

 Could not write method GdkEvent.get_state: No ArgType for 
GdkModifierType*

Sorry to bother you all with that, but maybe you can figure out what 
happens here.

rob

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Pythonian class instances inside a TreeModel

2003-01-15 Thread Roberto Cavada
Hi,
  the GTK+ FAQ states that user-defined data can be stored inside a 
GtkTreeModel via a hidden column.
How can I associate each row in the TreeModel with a user-defined 
python class instance? If I use an hidden column in the model, what's 
the type for that column?

Thanks,
rob

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] A Model-View-Controller implementation for pygtk2

2002-12-04 Thread Roberto Cavada
Hi all, 
  at http://sra.itc.it/people/cavada/dload/mvc.tar.bz2 can be found 
an implementation of the MVC pattern for pygtk2. 
I hope can be particularly useful when developing GTK based GUIs with 
pygtk and glade. For middle-size and large applications, the result 
is a more rational, structured domain separation. 
Also, reuse allows a more rapid prototyping of small and dummy 
applications. 

The key idea is (of course) to be able to separate the state of the 
application (the Model) and the representation for parts ot that 
state (the View). One or more glade files can be associated with a 
View, as well as widget hierarchies manually built by developers.  

In our implementation Model and View do not know each other. In the 
middle, one or more Controllers are located,  which handle signals 
fired by Views, and notifications of state changes fired by Models. 
In that sense our implementation is different from classic MVC 
pattern, but we think it is better integrated with the GTK toolkit. 

This MVC implementation is an important basement for gNuSMV, the GUI 
for the Open Source  Model Checker NuSMV we are developing. 
As you can guess (look at the version number 0.1.0! ) it is still an 
early version. 

The supplied archive contains the pattern implementation, an example 
of implementation, and a short document which describes the idea and 
the architecture. License is LGPL. 

In the immediate future we will extend it with:
- Multithreading support for models. 
- A better observable properties support.   

We welcome feedback! 
rob
   
--
Roberto Cavada
ITC-irst Institute for Scientific and Technological Research
Automated Reasoning Systems - Formal Methods Group
Via Sommarive, 18 - 38050 Povo (TN) - Italy
Tel: +39 0461 314 321   Fax: +39 0461 302 040
[EMAIL PROTECTED]  http://sra.itc.it/people/cavada/
--
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] Frozen pygtk code

2002-12-03 Thread Roberto Cavada
On Tuesday 03 December 2002 11:49, Christian Reis wrote:
  Has someone ever tried to freeze pygtk code
 Never did it. Do you mean for Win32, or using the freeze tools that
 come with Python source?
Second one. 
We're developing a GUI application (http://nusmv.irst.itc.it/gnusmv),  
fully based on python and gtk, both for win32 and unixes. 
Since pygtk2, gtk2, glade, etc., are not installed (or easily 
installable) on most of current unix distributions, currently the 
installation phase could be really bother and complex for the user.  
We assume that distributing frozen code could simplify several 
dependencies... 
rob
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] Frozen pygtk code

2002-12-02 Thread Roberto Cavada
Has someone ever tried to freeze pygtk code, in order to produce a 
more easily distributable code? 
rob
--
Roberto Cavada
ITC-irst Institute for Scientific and Technological Research
Automated Reasoning Systems - Formal Methods Group
Via Sommarive, 18 - 38050 Povo (TN) - Italy
Tel: +39 0461 314 321   Fax: +39 0461 302 040
[EMAIL PROTECTED]  http://sra.itc.it/people/cavada/
--
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] Problem using python2.2

2002-07-01 Thread Roberto Cavada

Hi all, 
  this scribble.py example (in pygtk-1.99.10/examples/simple dir) does 
not work if I invoke the python2.2.[01] interpreter (see error report 
below.)
The same example can be loaded if the python interpreter is version 
2.1, but it does not work anyway: only an empty window with a button 
in the bottom appears. 

GTK is 2.0.5 and pygtk is 1.99.10.
In general 'GtkWindow' is a bad name for the python version 2.2.
rob
-
%pwd
[...]/pygtk-1.99.10/examples/simple
%python2.2 scribble.py
Traceback (most recent call last):
  File .//scribble.py, line 79, in ?
main()
  File .//scribble.py, line 47, in main
win = GtkWindow()
NameError: global name 'GtkWindow' is not defined
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/