[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Gtk::FileFilter

WoodHacker

11/1/2006 2:15:00 PM

Can anyone explain to me how the Gtk::FileFilter work in a
FileChooserDialog? If I do the following, it works:

filter.add_pattern("*.rb")

However, if I try: filter.add_pattern("*.{rb, txt}") it does not
work. (As does nothing else I try)

And in the cases where it works (i.e. "*.rb") it gets a dropdown on the
FileChooser that's labeled "Untitled filter". Pressing it does nothing.
Obviously, I should be able to set the filter to rows labeled "All
Files, Ruby Files, Text Files", etc., with a default of say Ruby files
to start with.

Thanks in advanced...

Bill

7 Answers

akbarhome

11/1/2006 3:39:00 PM

0

WoodHacker wrote:
> Can anyone explain to me how the Gtk::FileFilter work in a
> FileChooserDialog? If I do the following, it works:
>
> filter.add_pattern("*.rb")
>
> However, if I try: filter.add_pattern("*.{rb, txt}") it does not
> work. (As does nothing else I try)
>
> And in the cases where it works (i.e. "*.rb") it gets a dropdown on the
> FileChooser that's labeled "Untitled filter". Pressing it does nothing.
> Obviously, I should be able to set the filter to rows labeled "All
> Files, Ruby Files, Text Files", etc., with a default of say Ruby files
> to start with.
>
> Thanks in advanced...
>
> Bill

Haven't use Ruby Gtk, but I have use pygtk. Because python is ruby
cousin, maybe my example in pygtk is useful to you.
# image filter
images_type = ('rgb', 'gif', 'pbm', 'pgm', 'ppm', 'tiff', 'rast',
'xbm', 'jpeg', 'jpg', 'bmp', 'png')
imagefilter = gtk.FileFilter()
for image_type in images_type:
imagefilter.add_pattern('*.' + image_type)
imagefilter.set_name(_("Images"))
filechooser_dialog.add_filter(imagefilter)

# all files filter
allfilter = gtk.FileFilter()
allfilter.add_pattern("*")
allfilter.set_name(_("All files"))
filechooser_dialog.add_filter(allfilter)

My guess is you have to do once for each pattern:
filter.add_pattern("*.rb")
filter.add_pattern("*.txt")

My understanding is you want a filter for ruby files and text files.
The case will be different if you want to use ruby files filter and
text files filter. Notice the different.

WoodHacker

11/2/2006 12:05:00 AM

0


akbarhome wrote:
> WoodHacker wrote:
> > Can anyone explain to me how the Gtk::FileFilter work in a
> > FileChooserDialog? If I do the following, it works:
> >
> > filter.add_pattern("*.rb")
> >
> > However, if I try: filter.add_pattern("*.{rb, txt}") it does not
> > work. (As does nothing else I try)
> >
> > And in the cases where it works (i.e. "*.rb") it gets a dropdown on the
> > FileChooser that's labeled "Untitled filter". Pressing it does nothing.
> > Obviously, I should be able to set the filter to rows labeled "All
> > Files, Ruby Files, Text Files", etc., with a default of say Ruby files
> > to start with.
> >
> > Thanks in advanced...
> >
> > Bill
>
> Haven't use Ruby Gtk, but I have use pygtk. Because python is ruby
> cousin, maybe my example in pygtk is useful to you.
> # image filter
> images_type = ('rgb', 'gif', 'pbm', 'pgm', 'ppm', 'tiff', 'rast',
> 'xbm', 'jpeg', 'jpg', 'bmp', 'png')
> imagefilter = gtk.FileFilter()
> for image_type in images_type:
> imagefilter.add_pattern('*.' + image_type)
> imagefilter.set_name(_("Images"))
> filechooser_dialog.add_filter(imagefilter)
>
> # all files filter
> allfilter = gtk.FileFilter()
> allfilter.add_pattern("*")
> allfilter.set_name(_("All files"))
> filechooser_dialog.add_filter(allfilter)
>
> My guess is you have to do once for each pattern:
> filter.add_pattern("*.rb")
> filter.add_pattern("*.txt")
>
> My understanding is you want a filter for ruby files and text files.
> The case will be different if you want to use ruby files filter and
> text files filter. Notice the different.

Multiple adds did the trick. Thanks...

BIG Bird

10/5/2012 4:50:00 PM

0


"Gary" <nos@none.com> wrote in message
news:6v2u68h8gfocor3tfnud7b4oo6lhfhi5au@4ax.com...
: On Fri, 05 Oct 2012 11:41:39 -0400, Emily <Emily@nospam.com> wrote:
:
: >I checked out the Obama site with the Obama merchandise and they have
: >T-shirts with Latinos for Obama, Hispanics for Obama, Nurses for
: >Obama, Asian Americans for Obama, and Environmentalists for Obama, but
: >no "Old white people for Obama". I guess I'll have to make my own.
:
: I'm still in a quandary. This is the first time in my life I've ever
: been a month from election day .... and still undecided. I use to
: think of an "undecided" voter as mentally mushy. Could I have been
: wrong :-)
:
ever wonder why you hillbillies are such perpetual losers ??


Emily

10/5/2012 6:57:00 PM

0

On Fri, 05 Oct 2012 12:36:29 -0400, Gary <nos@none.com> wrote:

>On Fri, 05 Oct 2012 11:41:39 -0400, Emily <Emily@nospam.com> wrote:

>>I checked out the Obama site with the Obama merchandise and they have
>>T-shirts with Latinos for Obama, Hispanics for Obama, Nurses for
>>Obama, Asian Americans for Obama, and Environmentalists for Obama, but
>>no "Old white people for Obama". I guess I'll have to make my own.
>
>I'm still in a quandary. This is the first time in my life I've ever
>been a month from election day .... and still undecided. I use to
>think of an "undecided" voter as mentally mushy. Could I have been
>wrong :-)

I have never been more undecided, other than 2008, of course.

We went to town yesterday, the first time I'd been in ages. I
insisted on going to the Obama HQ first because I wanted an Obama
button. The young lady at the desk said they didn't have any buttons,
but I could have a yard sign. I said that would be a waste since no
one would see it other than me and my husband. We chatted for a while
and then she reached under the counter and pulled out an Obama button
which she gave me.

I put it on and my husband took a picture of me standing in front of
the place. Now if he can ever figure out how to get a picture from
his phone to a computer...

We went to several stores where no one noticed my pin, or did a good
imitation of not seeing it. Then we had lunch and our waitress was a
very nice young woman with dark skin. At the end of the meal, she
came back and asked me what I thought about the debate. We had a nice
chat. She is, of course, rock solid like I am for Obama.

On to the grocery store. There, a white woman somewhere near my own
age commented on my button and said she had been for Obama until the
debate, but now she's learning toward Romney. We also had a nice chat
and I pointed out that Mittens had lied like a rug, and invited her to
check out some fact checking sites. We parted with my urging her not
to make any hasty decisions. It really shook me that someone who was
planning to vote for Obama would switch just because they didn't like
his debate performance, or hadn't grasped that Mittens hardly told any
truths.

Gary

10/5/2012 7:16:00 PM

0

On Fri, 05 Oct 2012 14:56:57 -0400, Emily <Emily@nospam.com> wrote:

>On Fri, 05 Oct 2012 12:36:29 -0400, Gary <nos@none.com> wrote:
>
>>On Fri, 05 Oct 2012 11:41:39 -0400, Emily <Emily@nospam.com> wrote:
>
>>>I checked out the Obama site with the Obama merchandise and they have
>>>T-shirts with Latinos for Obama, Hispanics for Obama, Nurses for
>>>Obama, Asian Americans for Obama, and Environmentalists for Obama, but
>>>no "Old white people for Obama". I guess I'll have to make my own.
>>
>>I'm still in a quandary. This is the first time in my life I've ever
>>been a month from election day .... and still undecided. I use to
>>think of an "undecided" voter as mentally mushy. Could I have been
>>wrong :-)
>
>I have never been more undecided, other than 2008, of course.
>
>We went to town yesterday, the first time I'd been in ages. I
>insisted on going to the Obama HQ first because I wanted an Obama
>button. The young lady at the desk said they didn't have any buttons,
>but I could have a yard sign. I said that would be a waste since no
>one would see it other than me and my husband. We chatted for a while
>and then she reached under the counter and pulled out an Obama button
>which she gave me.
>
>I put it on and my husband took a picture of me standing in front of
>the place. Now if he can ever figure out how to get a picture from
>his phone to a computer...

I don't have a phone. So I'm not sure. Maybe a usb cord like this ?

http://tinyurl.c...

http://www.restockit.com/cables-to-go-usb-cable-4-pin-usb-type-a-m-4...
usb-type-b-m-6-6-usb-hi-speed-usb-%28106758%29.html?source=IDx20111014
x00001g&utm_source=IDx20111014x00001g&utm_medium=paid&utm_campaign
=comparison&utm_term=DynamicPropertyName_SKU&bvar10=googlepla&ci_src=
17588969&ci_sku=106758&kw={keyword}&adtype=pla

>We went to several stores where no one noticed my pin, or did a good
>imitation of not seeing it. Then we had lunch and our waitress was a
>very nice young woman with dark skin. At the end of the meal, she
>came back and asked me what I thought about the debate. We had a nice
>chat. She is, of course, rock solid like I am for Obama.
>
>On to the grocery store. There, a white woman somewhere near my own
>age commented on my button and said she had been for Obama until the
>debate, but now she's learning toward Romney. We also had a nice chat
>and I pointed out that Mittens had lied like a rug, and invited her to
>check out some fact checking sites. We parted with my urging her not
>to make any hasty decisions. It really shook me that someone who was
>planning to vote for Obama would switch just because they didn't like
>his debate performance, or hadn't grasped that Mittens hardly told any
>truths.

I suppose this is the first time they ever listened to him close
enough to know he's a phoney.

I may vote for O -- but only out of self defense. It will not be a
proud moment in my life. I want to see a real American win.
Unfortunately -- none are running.

But if it makes you feel good ... go ahead an enjoy it :-)

Emily

10/5/2012 7:41:00 PM

0

On Fri, 05 Oct 2012 15:16:02 -0400, Gary <nos@none.com> wrote:

>On Fri, 05 Oct 2012 14:56:57 -0400, Emily <Emily@nospam.com> wrote:

>>>>I checked out the Obama site with the Obama merchandise and they have
>>>>T-shirts with Latinos for Obama, Hispanics for Obama, Nurses for
>>>>Obama, Asian Americans for Obama, and Environmentalists for Obama, but
>>>>no "Old white people for Obama". I guess I'll have to make my own.
>>>
>>>I'm still in a quandary. This is the first time in my life I've ever
>>>been a month from election day .... and still undecided. I use to
>>>think of an "undecided" voter as mentally mushy. Could I have been
>>>wrong :-)
>>
>>I have never been more undecided, other than 2008, of course.
>>
>>We went to town yesterday, the first time I'd been in ages. I
>>insisted on going to the Obama HQ first because I wanted an Obama
>>button. The young lady at the desk said they didn't have any buttons,
>>but I could have a yard sign. I said that would be a waste since no
>>one would see it other than me and my husband. We chatted for a while
>>and then she reached under the counter and pulled out an Obama button
>>which she gave me.
>>
>>I put it on and my husband took a picture of me standing in front of
>>the place. Now if he can ever figure out how to get a picture from
>>his phone to a computer...
>
>I don't have a phone. So I'm not sure. Maybe a usb cord like this ?
>
>http://tinyurl.c...
>
>http://www.restockit.com/cables-to-go-usb-cable-4-pin-usb-type-a-m-4...
>usb-type-b-m-6-6-usb-hi-speed-usb-%28106758%29.html?source=IDx20111014
>x00001g&utm_source=IDx20111014x00001g&utm_medium=paid&utm_campaign
>=comparison&utm_term=DynamicPropertyName_SKU&bvar10=googlepla&ci_src=
>17588969&ci_sku=106758&kw={keyword}&adtype=pla
>
>>We went to several stores where no one noticed my pin, or did a good
>>imitation of not seeing it. Then we had lunch and our waitress was a
>>very nice young woman with dark skin. At the end of the meal, she
>>came back and asked me what I thought about the debate. We had a nice
>>chat. She is, of course, rock solid like I am for Obama.
>>
>>On to the grocery store. There, a white woman somewhere near my own
>>age commented on my button and said she had been for Obama until the
>>debate, but now she's learning toward Romney. We also had a nice chat
>>and I pointed out that Mittens had lied like a rug, and invited her to
>>check out some fact checking sites. We parted with my urging her not
>>to make any hasty decisions. It really shook me that someone who was
>>planning to vote for Obama would switch just because they didn't like
>>his debate performance, or hadn't grasped that Mittens hardly told any
>>truths.
>
>I suppose this is the first time they ever listened to him close
>enough to know he's a phoney.
>
>I may vote for O -- but only out of self defense. It will not be a
>proud moment in my life. I want to see a real American win.
>Unfortunately -- none are running.

I don't think my husband is convinced yet, but he's far more undecided
than ever before and, I suspect, would never admit it if he did
actually vote for Obama. He admitted yesterday that he's concerned
about the Romney/Ryan approach to Medicare and SS. Now that he's on
those things, he's a bit more interested. Funny how that happens.
>
>But if it makes you feel good ... go ahead an enjoy it :-)

I'm not going to feel good until this damned election is over.

Gary

10/5/2012 8:47:00 PM

0

On Fri, 05 Oct 2012 15:41:29 -0400, Emily <Emily@nospam.com> wrote:

>On Fri, 05 Oct 2012 15:16:02 -0400, Gary <nos@none.com> wrote:
>

>>I may vote for O -- but only out of self defense. It will not be a
>>proud moment in my life. I want to see a real American win.
>>Unfortunately -- none are running.
>
>I don't think my husband is convinced yet, but he's far more undecided
>than ever before and, I suspect, would never admit it if he did
>actually vote for Obama. He admitted yesterday that he's concerned
>about the Romney/Ryan approach to Medicare and SS. Now that he's on
>those things, he's a bit more interested. Funny how that happens.

I meant to address this in my last post.

I can understand how your husband feels. Were it not for Ryan --
and his hatred of Medicare and SS -- there would be no question at
all in my mind about voting for Romney.

But there are rare times in our life, when we must put one issue over
our personal likes or dislikes of certain people. This is my first
experience. So unless Romney can say something about Medicare to
change my mind, I will be voting for the Indonesian next month.