I'm porting a PyQt4 (PySide) application that I wrote for Linux and Windows to OS X, menus seem to be otherwise OK out of the box (i.e. Help menu that only has About in it is magically moved to the "main menu" and a File menu is created just fine, but the "main" menu is titled Python instead of Application name.
I call self.setWindowTitle("Appname") in MainWindow.__init__() and self.setApplicationName("Appname") in Application.__init__() but the result is this:
How can I fix this? - Preferably in a way that my app still looks the same as it did before on Windows & Linux.
So it looks like Mac does something different than the other OS systems. I don't have a Mac so I can't really test it out but I think on a Mac the QMainWindow.menuBar() function does not return the application wide menu bar. You might try creating menubar like.
menubar = QtGui.MenuBar()
that has no parent.
I'm getting this information from the following links.
From the documents
Deploying an Application on Mac OS X
Also, it looks like the file Info.plist in "The Bundle" section of the second link is where the application name would live.
I'm sorry I can't be of more help but I hope this information will help you. Good luck!
Related
I am creating an app for Mac OS, but it is being built on Linux. Because of this, I am not able to use tools such as Xcode, and I am not developing in swift. Rather, the .app directory is being put together according to Apple's documentation, and the entrypoint/executable of my app is a shell script.
I need to customize the menu which appears when you right click on the app (either on the dock icon or in Finder). Is there a way to do this, without using cocoa, etc.?
The menu I believe you are referring to is called "Services".
In order to add a menu item there for your application you would create a script to enable including it there. Xcode isn't needed or required, however, you'll need to know at the very least some basic AppleScript or Javascript to accomplish what you want. (see examples from the link)
↳ Mac Automation Scripting Guide
I am struggling to figure out how RCP applications on Mac OS work with "About" and "Preferences" actions. I create them with ActionFactory and place them to relevant file menus. Works fine everywhere. However, on Mac OS those actions get placed into application menu by something which knows better where to put other peoples good actions. But of course they don't work.. Any idea why?
(eclipse target platform 3.7, OSX - the latest El Capitan)
For the 3.x style action bar advisor add the menu item in the normal place but use an ActionContributionItem and set the menu item in be invisible on the Mac:
So for Quit something like:
IWorkbenchAction quitAction = ActionFactory.QUIT.create(window);
register(quitAction);
ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
'About' and 'Preferences' can also be specified like this.
Util is org.eclipse.jface.util.Util.
Eclipse will find these items and move them to the correct place.
I just created a screensaver project in Xcode. How do I change the name as it appears on the screen saver selection dialog in MacOSX. I'm referring to the string bellow the thumbnails, like "Floating", "Flip-up", etc in this screenshot:
Note: I don't want to change the name of the screensavers that were shipped with MacOSX. I want to change the name of my own. The screenshot is there just to illustrate what I mean by name.
This took me a little while to figure out. There should be a file called InfoPlist.strings in your project (create one if not, I suppose), with an entry CFBundleName. This is the string used to generate the title, at least as of OS X 10.11.
The name you use for your screensaver (.saver bundle) will be the title it's represented as when viewed in System Preferences > Desktop & Screen Saver.
Example:
In XCode you might have a screensaver project named: Amazing Things.
When you build/compile an Amazing Things.saver bundle will be created (similar to an .app)
The main executable Amazing Things resides in Amazing Things.saver/Contents/MacOS
Screensaver titles are fetched from the .saver bundle and displayed as such in OS X.
(note the title in System Preferences reflects that of which the project was named):
I am developing an cocoa application for Mac and what i need is to add an item in the context menu that appears when user right-clicks on specific file and folder (i.e. when user click on file or folder by pressing ctrl key of keyboard).
I am new to Cocoa application development. I have searched in google for it and found that it can be implemented by using CFPlugIn. Does anyone know how to use CFPlugIn to implement this or any other method to add item in context menu of specific file or folder??
Thanks in advance
You can use system services for contextual menu. you should refer Services Implementation Guide. take a look at Services step out in Snow Leopard article.
If you wish to sell your product on apple app store than you should not follow dropbox.
This is no longer supported in Mac OS X 10.6 and Mac OS X 10.7. Earlier versions of Mac OS X had support for contextual menu plugins, but this feature has since been removed.
What is it you're trying to accomplish in the broader sense? If you give us an idea of what your goal is, we may be able to suggest an alternate way to accomplish it.
Using System Extensions and a FinderSync extension you can accomplish this.
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html
I wrote a simple Mac 'Service' for Finder, that executes a command.
Basically: this adds a ContextMenu in Finder.
If I right-click a file in Finder, a menu item pops up. If the user clicks it, it executes my script. (kind of like 'Send to Bluetooth device, ...')
In OS X Leopard (10.5) and earlier, all services are enabled.
In 10.6 (Snow Leopard), Apple changed the behavior, services now have preferences, and can be enabled or disabled by the user. (which is a good thing)
However, I wrote the service, but there seems to be no way to enable it automatically (in our installer).
I tried doing it with Applescript, going to the System Preferences and ticking the checkbox that way, but it requires some accessibility features to be turned on. (off by default).
Is it possible? If so, how?
Or do I need something else to provide Context Menus in Finder.
I tracked File changes on my filesystem while changing the preferences and discovered there was a plist file:
~/Library/Prefrences/pbs.plist
which contains what I need.
If I edit that manually, it seems to work. So, problem solved :)