Re: [Gimp-developer] Metadata-Browser and Widgets
Hi, On Sat, 2010-04-17 at 17:25 +1000, Roman Joost wrote: My understanding so far, if I would inherit from my GtkEntry widget, I wouldn't be able to overwrite my implementation so I can display a GtkTextView. I also thought about inheriting from a more basic widget and somehow use a GtkEntry or GtkTextView as a property. That didn't really worked well either. Now I have a similar implementation working with a GtkTextView as a base class including borrowed code from my GtkEntry. I would like to merge both to something more flexible, but I can't really think of a better architecture. How much code does the TextView class actually borrow from the Entry class? What does this code do? There are certainly ways to share most of this code, but probably not by inheritance. Some utility functions called from both classes might be sufficient, or you use composition and embed a common object in your TextView and Entry objects. Maybe the clue is to overwrite the constructor which returns either a GtkEntry, a GtkTextView or ...? No, that wouldn't work. The constructor can't change the type of object it returns. Sven ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Calling a function from a custom module
Hey all. I'm more or less a beginner when it comes to GIMP scripting (though I do have a few years of exp in general development) and I've run into a bump with PyGimp that I was hoping someone might be able to give me a hand with. As general practice, I've written a function that I put inside a file called ofstream.py (placed in the same folder as gimpfu.py), which consists of: def fout: f = open(C:\testFile.dat) f.write(Hello World!) f.close() I then have another script (placed in my plugins folder, to be picked up by Gimp) which contains: import math from gimpfu import * from ofstream import * def testFile: fout() #register code follows... But I keep getting an 'execution error' linked to the fout statement. If I comment out that line and replace it with something else, it works fine. The 'import ofstream' line gives me no trouble; its the function call thats the problem. Why am I having this issue? I can use functions located in gimpfu.py just fine (register, main, etc). Why can't I use my own function? Thanks in advance everyone. Cheers. -- Jason S. (via www.gimpusers.com) ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Calling a function from a custom module
On Sun, Apr 18, 2010 at 11:12:05AM +0200, Jason S. wrote: As general practice, I've written a function that I put inside a file called ofstream.py (placed in the same folder as gimpfu.py), which consists of: [...] example code But I keep getting an 'execution error' linked to the fout statement. Could you paste the error as well? If I comment out that line and replace it with something else, it works fine. The 'import ofstream' line gives me no trouble; its the function call thats the problem. IMHO it's better do use absolute imports like: import ofstream ofstream.fout() But that will not fix your problem. Why am I having this issue? I can use functions located in gimpfu.py just fine (register, main, etc). Why can't I use my own function? It would be much more helpful if you could paste the whole traceback... If you can import your module, it should also be possible to access your function. What will happen if you you explicitly import your function: from ofstrem import fout Cheers -- Roman Joost www: http://www.romanofski.de email: romanof...@gimp.org signature.asc Description: Digital signature ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Calling a function from a custom module
Thanks for the reply. I tried importing the 'fout' function explicitly; it worked. from ofstream import fout worked just fine. No problems. I still have an issue using the 'fout' function though. I know its not a problem with the code within the function; I've tried copying the fout function code and placing it within my module directly- that works fine. The only error info I get is: Traceback (most recent call last): File input, line 1, in module RuntimeError: execution error which really isnt much to work with- this is what makes PyGimp debugging so frustrating. When you're working with .NET, Flash or even C/C++, your compiler / interpreter at least gives you some insight into your problem with its error messages. PyGimp won't even give me a line number . Anyways, any help is much appreciated. Thanks heaps every1. Cheers, Jay. -- Jason S. (via www.gimpusers.com) ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] GSoc - Brush Selector Widget
Hi, I received a comment on my Gimp Gsoc proposal from Martin a couple hours ago. To answer Martin’s question, and think about what UI adjustments are needed for Brush Selector Widget, it may help to discuss here, to see whether my understanding is correct. After having some feedback, I can make some scratches on paper for the new UI, and also can use Gimp or Inkscape to design the UI mock-up. One of the goals of the project on UI is to allow more precise brush selection. For example, users can easily input and see effects with size, angle, and aspect ratio values. Currently, these cannot be done easily. Brushes are rather complex in Gimp. 1. In Brush Selection, basically there is a list of brushes to select. There is only parameter to adjust for the selection underneath is Spacing. 2. To customize a brush, there are many parameters to choose in Tool Options for brushes. 3. Users can also right click on brushes to duplicate and modify it, or create a new brush, with input of size, angle, and aspect ratio. Therefore, there are these many places to choose a brush: Brush Selector, Tool Options, and Brush Editor. In this project, size, angle, and aspect ratio are important parameters for brush selection. In the UI, my idea is to have widgets of size (radius), angle, and aspect ratio in Brush Selection Widget, maybe under where Spacing is. Then, users can have a brush that has these precise input parameters, without needing to create a new brush copy and adjust them there. This should be a small task, so that some frequently used widgets would be in a more accessible place. I have some other ideas for the UI design. What are your thoughts on the UI? Maybe Alexia, the mentor of this project, has some good ideas. I am interested to know what other tasks are and make it a three-month project. Regards, Zhenfeng. ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] GSoc - Brush Selector Widget
Zhenfeng Zhao wrote: I received a comment on my Gimp Gsoc proposal from Martin a couple hours ago. To answer Martin’s question, and think about what UI adjustments are needed for Brush Selector Widget, it may help to discuss here, to see whether my understanding is correct. After having some feedback, I can make some scratches on paper for the new UI, and also can use Gimp or Inkscape to design the UI mock-up. One of the goals of the project on UI is to allow more precise brush selection. For example, users can easily input and see effects with size, angle, and aspect ratio values. i think (and I have thought and discussed about it quite a bit with usual suspects like alexia and pippin) that trying out is best done with the full parameters of _this_moment_, on the canvas or a copy of the canvas. after I attended a sprint with krita, they have implemented a variant of that. you can see blogs about that. Currently, these cannot be done easily. Brushes are rather complex in Gimp. 1. In Brush Selection, basically there is a list of brushes to select. There is only parameter to adjust for the selection underneath is Spacing. and that one will be transferred to the tool options 2. To customize a brush, there are many parameters to choose in Tool Options for brushes. 3. Users can also right click on brushes to duplicate and modify it, or create a new brush, with input of size, angle, and aspect ratio. for a vector brush, yes. pixmap: I believe not. Therefore, there are these many places to choose a brush: Brush Selector, Tool Options, and Brush Editor. In this project, size, angle, and aspect ratio are important parameters for brush selection. after reading that a couple of times, I think you are talking about making a vector brush from scratch for temporary use. In the UI, my idea is to have widgets of size (radius), angle, and aspect ratio in Brush Selection Widget, maybe under where Spacing is. Then, users can have a brush that has these precise input parameters, without needing to create a new brush copy and adjust them there. This should be a small task, so that some frequently used widgets would be in a more accessible place. I think we want to have the 'from scratch' mode mutual exclusive with the 'from collection' mode. this separates nicely the 2 modes users are. this must be done by switching the mode at the top of the brush selection dialog (a copy of which also pops up in the tool options). of course a 'from scratch' brush can be saved into the collection. then it has become clear that the 'from scratch' mode is equal to the brush editor (which can definitely use improvements). ah, and when you implement a pattern like that, you will be required (I bet) to make the changes in such a way that they get applied to all resources (patterns, gradients, etc). --ps founder + principal interaction architect man + machine interface works http://mmiworks.net/blog : on interaction architecture ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] GSoc - Brush Selector Widget
Hi Peter, Thank you for the quick feedback... On Sun, Apr 18, 2010 at 6:40 PM, peter sikking pe...@mmiworks.net wrote: i think (and I have thought and discussed about it quite a bit with usual suspects like alexia and pippin) that trying out is best done with the full parameters of _this_moment_, on the canvas or a copy of the canvas. after I attended a sprint with krita, they have implemented a variant of that. you can see blogs about that. Yes, it is the way that I do it too. One can see if the effect is good, if trying it out (playing with it). Currently, these cannot be done easily. Brushes are rather complex in Gimp. 1. In Brush Selection, basically there is a list of brushes to select. There is only parameter to adjust for the selection underneath is Spacing. and that one will be transferred to the tool options OK. I can do the transferring in the project, moving Spacing to tool options. 2. To customize a brush, there are many parameters to choose in Tool Options for brushes. 3. Users can also right click on brushes to duplicate and modify it, or create a new brush, with input of size, angle, and aspect ratio. for a vector brush, yes. pixmap: I believe not. Right. The duplicate brush on right click is disabled for them. For vector brush, they can be cloned and modified. Therefore, there are these many places to choose a brush: Brush Selector, Tool Options, and Brush Editor. In this project, size, angle, and aspect ratio are important parameters for brush selection. after reading that a couple of times, I think you are talking about making a vector brush from scratch for temporary use. So far, I thought about vector brushes. Input from Alexia would be appreciated. I hope to understand the project goals better. I do see some drawbacks of the current UI. There are a few ways to improve it. I am interested to know the approach that has a good UI design, and its changes can fit in the architecture. In the UI, my idea is to have widgets of size (radius), angle, and aspect ratio in Brush Selection Widget, maybe under where Spacing is. Then, users can have a brush that has these precise input parameters, without needing to create a new brush copy and adjust them there. This should be a small task, so that some frequently used widgets would be in a more accessible place. I think we want to have the 'from scratch' mode mutual exclusive with the 'from collection' mode. this separates nicely the 2 modes users are. this must be done by switching the mode at the top of the brush selection dialog (a copy of which also pops up in the tool options). of course a 'from scratch' brush can be saved into the collection. then it has become clear that the 'from scratch' mode is equal to the brush editor (which can definitely use improvements). OK, it sounds like a good solution. There can be two modes: choose from the brush selection/collection, and create a brush using brush editor. The brush editor often hides now. I could be wrong, but maybe most users do not even notice its exist. However, brush editor is very useful to create a customized vector brush. ah, and when you implement a pattern like that, you will be required (I bet) to make the changes in such a way that they get applied to all resources (patterns, gradients, etc). How does the modification apply to patterns and gradients? Do you mean when using a brush shape and a pattern for the stroke? In Clone tool, pattern and brush can be selected separately to use together. If so, I can see there is some work to use a customized brush. Wait, if I make a vector brush using brush editor, and use a pattern source in Clone tool, it works and puts pattern in the shape that I just created. So, if I adjust the UI to have two modes, a newly created vector brush should work with patterns right away, right? Regards, Zhenfeng. --ps founder + principal interaction architect man + machine interface works http://mmiworks.net/blog : on interaction architecture ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Calling a function from a custom module
On Sun, Apr 18, 2010 at 02:22:44PM +0200, Jason S. wrote: I tried importing the 'fout' function explicitly; it worked. from ofstream import fout worked just fine. No problems. Maybe you're overwriting a function or method which is declared elsewere with the same name and that's why you get your mysterious results? The only error info I get is: Traceback (most recent call last): File input, line 1, in module RuntimeError: execution error Hm.. You're right - not really helpful. Where is 'input' coming from? Hm... maybe it is passed as a text or string and executed ... which really isnt much to work with- this is what makes PyGimp debugging so frustrating. When you're working with .NET, Flash or even C/C++, your compiler / interpreter at least gives you some insight into your problem with its error messages. PyGimp won't even give me a line number . Does this code work if you put it into a Python module and don't execute it from within GIMP afterall? There is also a Python console available in GIMP from where you can start trying to debug your program. Cheers, -- Roman Joost www: http://www.romanofski.de email: romanof...@gimp.org signature.asc Description: Digital signature ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Calling a function from a custom module
Quoting Jason S. for...@gimpusers.com: Hey all. I'm more or less a beginner when it comes to GIMP scripting (though I do have a few years of exp in general development) and I've run into a bump with PyGimp that I was hoping someone might be able to give me a hand with. As general practice, I've written a function that I put inside a file called ofstream.py (placed in the same folder as gimpfu.py), which consists of: def fout: f = open(C:\testFile.dat) f.write(Hello World!) f.close() Doesn't the backslash need to be escaped in Python string constants? ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer