View Single Post
Old 07-24-2014, 05:42 PM   #1
kabirmaar
Member
kabirmaar began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2014
Device: none
Install of simple plugin works on Linux and Win but not on OSX

I started to work on plugin Kaliweb.

At the moment it is very simple start. It only brings QWebView opened like a drop down menu from main toolbar (screenshots at the bottom). My idea is to make a skeleton so one could bring to Calibre remote web service, local HTML/JS or web app running locally.

Code is at: https://bitbucket.org/kabiir/kaliweb/src

Problem: it installs seamlessly on vanilla Ubuntu Live and vanilla WindowsXP. It doesn't install completely on OSX. It doesn't ask for placement of the icon to toolbars. It just installs there but after restart I can't find the icon in Preferences>Toolbar. But, if I start Calibre from terminal like:
Quote:
calibre-debug -g
I can find the icon in Preferences>Toolbar and if I add it to main toolbar it works as expected.

If I run Calibre normally e.g. double click on icon in Applications, after it worked in debug mode, it still doesn't work. If I run it again as `calibre-debug -g` it works fine.

I think that code which should be considered is in InterfaceAction class (https://bitbucket.org/kabiir/kaliweb...master#cl-57):

Code:
   def genesis(self):
        icon_resources = self.load_resources(PLUGIN_ICONS)
        set_plugin_icon_resources(self.name, icon_resources)

        self.qaction.setIcon(get_icon(PLUGIN_ICONS[0]))
        self.old_actions_unique_map = {}
        self.us = UnitedStates()

        res = self.load_resources(PORTABLE_RESOURCES)
        os.makedirs(os.path.join(self.us.portable_directory, 'portable'))
        for resource in res.keys():
            logger.debug("RESOURCE KEY: {}".format(resource))
            with open(os.path.join(self.us.portable_directory,
                                   resource), 'wb') as portable:
                portable.write(res[resource])

        self.popup_type = QToolButton.InstantPopup

        base_plugin_object = self.interface_action_base_plugin
        do_user_config = base_plugin_object.do_user_config

        self.d = KaliwebDialog(self.gui,
                               self.qaction.icon(),
                               do_user_config,
                               self.qaction, self.us)
        m = QMenu(self.gui)
        self.qaction.setMenu(m)
        a = QWidgetAction(m)
        a.setDefaultWidget(self.d)
        m.addAction(a)
I don't have idea how to start to debug that. It is obviously something which affects only OSX but somehow it doesn't if it is run as `calibre-debug -g`.

Any idea?
Attached Thumbnails
Click image for larger version

Name:	kaliweb_in_action.png
Views:	728
Size:	164.5 KB
ID:	125803   Click image for larger version

Name:	OSX_finished_installation.png
Views:	690
Size:	304.9 KB
ID:	125804   Click image for larger version

Name:	OSX_running_kaliweb.png
Views:	702
Size:	270.9 KB
ID:	125805  
kabirmaar is offline   Reply With Quote