gtkmm - error message from gtk::appchooserdialog - gtkmm

Here is the code..
Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filepath);
Gtk::AppChooserDialog *dialog = new Gtk::AppChooserDialog(file, *this);
if ( dialog->run() == Gtk::RESPONSE_OK ) {
Glib::RefPtr<Gio::AppInfo> appinfo = dialog->get_app_info();
appinfo->launch(file);
}
dialog->hide();
This is the message i get when the above code is executed..
glibmm-WARNING **: Glib::ConstructParams::ConstructParams(): object class "gtkmm__GtkAppChooserDialog" has no property named "file"
I'm probably making a silly mistake here. Can anyone help me with this? Thanks in advance..

Well, in gtk-3.0, there is no GtkAppChooserDialog property named "file", but there is a property named "gfile". This appears to be a bug in the gtkmm wrapping where "file" should have been "gfile" in the appropriate _CONSTRUCT() call (currently line 38 and 44), but I don't have enough wrapper understanding to be sure. If this is the problem, I don't see an easy workaround without patching gtkmm.
Update: It was a bug in the wrapping.

Related

Error implementing settings when instantiating the AudioPlayer class / AudioLoadConfiguration

For example:
When using the AudioPlayer class together with just_audio_background, the initialization settings are ignored.
But when I use it without just_audio_background it works as expected. It looks like loading the settings together with just_audio_background is not implemented.
Has anyone ever experienced this? Or would you have a suggestion?
final _player = AudioPlayer( audioLoadConfiguration: AudioLoadConfiguration( androidLoadControl: AndroidLoadControl( bufferForPlaybackDuration: const Duration(seconds: 10), prioritizeTimeOverSizeThresholds: true), ), );
Has anyone ever experienced this? Or would you have a suggestion?
I need to specify bufferForPlaybackDuration.

Mobx : changing (observed) observable values without using an action is not allowed (asynchronus handler)

we know all this problem, and know how to solve it.
But I have an stranger Error in this context where I could use a good hint:
this.getData(id)
.then((response) => {
this.root.basic.selected.num = response.data.number; // number
this.root.basic.selected.date = response.data.date; // Date
this.root.basic.selected.text = response.data.text; // String. <- There is the error
}
})
The selected Object is bound by the "makeAutoObserveable()" Nothing special here. But a lot of code to push it all here.
Why this error happens only on the .text setter not on the others?
Is this a possible known behavior?
I solved it with "runInAction()" but I would like to understand the reason.
Kind Regards
Gregor

Using with_context in super call turns into infinite call in odoo

In odoo context dictionary is frozen so no one can update it,
for that one solution is also available is calling method using with_context.
ctx = self.env.context.copy()
ctx.update({'additional_parameter' : value})
self.with_context(ctx).methodname()
but when we use the same pattern to call super method then result turns into the infinite call.
ctx = self.env.context.copy()
ctx.update({'additional_parameter' : value})
super(product_product, self).with_context(ctx).create(vals)
Any help will be highly appreciated.
I think you should try something like this at respective line:
super(product_product, self.with_context(ctx)).create(vals)

CoreText CopyFontsForRequest received mig IPC error

I've been working on a BIG project (there's no point of showing any actual code anyway) and I've notice that the following message appears in the logs:
CoreText CopyFontsForRequest received mig IPC error (FFFFFFFFFFFFFECC) from font server
The error pops up as soon as a WebView has finished loading. And I kinda believe it's the culprit behind a tiny lag.
Why is that happening? What can I do to fix this?
P.S. Tried the suggested solution here to check whether it was something system-specific, but it didn't work.
More details:
The error appears when using the AMEditorAppearance.car NSAppearance file, from the Appearance Maker project. Disabling it (= not loading it all) makes the error go away.
I don't really care about the error message, other than that it creates some weird issues with fonts. E.g. NSAlert panels, with input fiels, show a noticeable flicker and the font/text seems rather messed up, in a way I'm not sure I can accurately describe. (I could post a video with that if that'd help)
This is probably related to system font conflicts and can easily be fixed:
Open Font book
Select all fonts
Go to the file menu and select "Validate fonts"
Resolve all font conflicts (by removing duplets).
Source: Andreas Wacker
Answer by #Abrax5 is excellent. I just wanted to add my experience with this problem and could not fit it into a comment:
As far as I can tell, this error is raised only on the first failed attempt to initialise an NSFont with a font name that is not available. NSFont initialisers are failable and will return nil in such a case at which time you have an opportunity to do something about it.
You can check whether a font by a given name is available using:
NSFontDescriptor(fontAttributes: [NSFontNameAttribute: "<font name>"]).matchingFontDescriptorWithMandatoryKeys([NSFontNameAttribute]) != nil
Unfortunately, this also raises the error! The following method does not, but is deprecated:
let fontDescr = NSFontDescriptor(fontAttributes: [NSFontNameAttribute: "<font name>"])
let isAvailable = NSFontManager.sharedFontManager().availableFontNamesMatchingFontDescriptor(fontDescr)?.count ?? 0 > 0
So the only way I found of checking the availability of a font of a given name without raising that error is as follows:
public extension NSFont {
private static let availableFonts = (NSFontManager.sharedFontManager().availableFonts as? [String]).map { Set($0) }
public class func available(fontName: String) -> Bool {
return NSFont.availableFonts?.contains(fontName) ?? false
}
}
For example:
NSFont.available("Georgia") //--> true
NSFont.available("WTF?") //--> false
(I'm probably overly cautious with that optional constant there and if you are so inclined you can convert the returned [AnyObject] using as! [String]...)
Note that for the sake of efficiency this will not update until the app is started again, i.e. any fonts installed during the app's run will not be matched. If this is an important issue for your particular app, just turn the constant into a computed property:
public extension NSFont {
private static var allAvailable: Set<String>? {
return (NSFontManager.sharedFontManager().availableFonts as? [String]).map { Set($0) }
}
private static let allAvailableAtStart = allAvailable
public class func available(fontName: String) -> Bool {
return NSFont.allAvailable?.contains(fontName) ?? false
}
public class func availableAtStart(fontName: String) -> Bool {
return NSFont.allAvailableAtStart?.contains(fontName) ?? false
}
}
On my machine available(:) takes 0.006s. Of course, availableAtStart(:) takes virtually no time on all but the first call...
This is caused by calling NSFont fontWithFamily: with a family name argument which is not available on the system from within Chromium's renderer process. When Chromium's sandbox is active this call triggers the CoreText error that you're observing.
It happens during matching CSS font family names against locally installed system fonts.
Probably you were working on a Chromium-derived project. More info can be found in Chromium Bug 452849.

FOlder Watcher - Cocoa/Obj C

I need to watch a specified folder for specific type of file (pdf) and get notification only when file is "Created" or "Renamed".
I tried many Obj c wrappers like SCEvents, UKKQueue etc., I could not get the type of the event raised("Created" or "Renamed") inside the notification delegate.I am just getting a flag/some#.I also tried FSEventStream which was not raising callback.Refered URL for this:OSX FSEventStreamEventFlags not working correctly.
In SCEvents, I have below delegate which is not telling me the type of event-
- (void)pathWatcher:(SCEvents *)pathWatcher eventOccurred:(SCEvent *)event {
NSLog(#"%#", event);
}
Getting below log-
2014-02-27 16:41:59.342 PMLauncher6[5187:303] <SCEvent { eventId = 661674, eventPath = /Users/Test, eventFlag = 67584 } >
Any one has any idea on the same or better way to meet the requirement, kindly advise.
Thanks
Try NSWorkspace - noteFileSystemChanged:.
The documentation doesn't tell much about it, but as a Notification that "Informs the NSWorkspace object that the file system changed at the specified path." it should fit to your needs.