[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Allow switching skin while lmi is running

From: Vadim Zeitlin
Subject: Re: [lmi] Allow switching skin while lmi is running
Date: Thu, 2 Jun 2016 02:06:47 +0200

On Wed, 1 Jun 2016 23:45:43 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2016-06-01 22:29, Vadim Zeitlin wrote:
GC> > On Wed, 1 Jun 2016 22:17:21 +0000 Greg Chicares <address@hidden> wrote:
GC> [...editing default_input_filename_ in a wxFilePickerCtrl...]
GC> > GC> > 
GC> > GC> > [...] I'm pretty sure we want wxFLP_FILE_MUST_EXIST
GC> > GC> 
GC> > GC> Now I'm not so sure.
GC> > 
GC> >  I still think this flag should be used, but perhaps it should be possible
GC> > to leave the field empty if you just have no appropriate candidate file at
GC> > all.
GC> Then what should be the behavior of a system built from the public
GC> repository only--say, by someone unknown to us who might want to use
GC> lmi? The builtin default is "/etc/opt/lmi/default.ill", which in that
GC> case will not exist. I'd like something appropriate to happen, with no
GC> annoying warning.

 It's actually possible to initialize a wxFilePickerCtrl using
wxFLP_FILE_MUST_EXIST style with a non-existent path and this was, AFAIR,
even done on purpose to allow it to be used in the situations such as this.
Of course, it's still a bit strange because if you choose some other
(necessarily existing) file and want to reset the control back to its
initial value, you won't be able to do it. But as long as you don't change
it at all, nothing will happen and no warnings will be given.

GC> >  Would it be conceivable to modify this code to skip calling access() if
GC> > default_input_file is empty?
GC> - if(0 != access(default_input_file.c_str(), F_OK))
GC> + if(default_input_file.empty() || 0 != access(default_input_file.c_str(), 
GC> Sure, but may I ask why?

 I must admit I haven't thought this through, I just immediately noticed
that it didn't make any sense to call access() if the default file was
empty (which would be possible now, with my proposal above), but I didn't
think that it would still behave correctly even if we do call it with an
empty string. So I withdraw this request, sorry.

GC> Or is this intended as a speed optimization (which I would expect to
GC> save few if any cycles)?

 Yes, it could be seen as an optimization and it probably saves at least a
few hundreds cycles but, of course, we don't care about this here.

 Sorry for a false alert,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]