Why does my budgie applet not display in the budgie-panel?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












I am writing an applet for Ubuntu Budgie in python.I wrote some code,debugged with no errors, saved it and put the folder with the files in ~/.local/share/budgie-desktop/plugin directory so I can add it on panel.I tried to add it as an applet but nothing happened.So I am not sure if is running smoothly or not.
The code is in this link



https://gist.github.com/cgiannakidis70/db0cf31558e6c20e95716679b831fd8f



#!/usr/bin/env python3

import os
import gi
import gi.repository
gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk, Gio

class myapplet(GObject.GObject, Budgie.Plugin):

__gtype_name__ = "myapplet"

def __int__(self):

GObject.GObject.__init__(self)

def do_get_panel_widged(self, uuid):

return myappletApplet(uuid)

class myappletApplet(Budgie.Applet):

def __init__(self, uuid):

Budgie.Applet.__init__(self)

self.button = Gtk.ToggleButton.new("A")
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
self.add(self.button)
self.button.connect("clicked", self.button_clicked)
self.show_all()

def button_clicked(self):

dialog = menu(self)
response = dialog.run()

dialog.destroy()

#Create Menu
menu = Gio.Menu()
menu.append("About This PC", "app.about_this_pc")
self.set_applet_menu(menu)

#create an action for the option "About This PC" of the menu
about_this_pc_action = Gio.SimpleAction.new("about_this_pc", None)
about_this_pc_action.connect("activate", self.about_this_pc_cb)
self.add_action(about_this_pc_action)



def about_this_pc_cb(self, action, parameter):

print("About This PC")




Gtk.main()


The applet is about a button in panel which every time i push it opens a dropdown menu with some options that can be activated.Like the "user-indicator-applet".



Right now I am stacked and I can not continue the code .Any help will be appreciated.
Thanks in advance.










share|improve this question























  • I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
    – fossfreedom♦
    Mar 17 at 11:20















up vote
1
down vote

favorite












I am writing an applet for Ubuntu Budgie in python.I wrote some code,debugged with no errors, saved it and put the folder with the files in ~/.local/share/budgie-desktop/plugin directory so I can add it on panel.I tried to add it as an applet but nothing happened.So I am not sure if is running smoothly or not.
The code is in this link



https://gist.github.com/cgiannakidis70/db0cf31558e6c20e95716679b831fd8f



#!/usr/bin/env python3

import os
import gi
import gi.repository
gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk, Gio

class myapplet(GObject.GObject, Budgie.Plugin):

__gtype_name__ = "myapplet"

def __int__(self):

GObject.GObject.__init__(self)

def do_get_panel_widged(self, uuid):

return myappletApplet(uuid)

class myappletApplet(Budgie.Applet):

def __init__(self, uuid):

Budgie.Applet.__init__(self)

self.button = Gtk.ToggleButton.new("A")
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
self.add(self.button)
self.button.connect("clicked", self.button_clicked)
self.show_all()

def button_clicked(self):

dialog = menu(self)
response = dialog.run()

dialog.destroy()

#Create Menu
menu = Gio.Menu()
menu.append("About This PC", "app.about_this_pc")
self.set_applet_menu(menu)

#create an action for the option "About This PC" of the menu
about_this_pc_action = Gio.SimpleAction.new("about_this_pc", None)
about_this_pc_action.connect("activate", self.about_this_pc_cb)
self.add_action(about_this_pc_action)



def about_this_pc_cb(self, action, parameter):

print("About This PC")




Gtk.main()


The applet is about a button in panel which every time i push it opens a dropdown menu with some options that can be activated.Like the "user-indicator-applet".



Right now I am stacked and I can not continue the code .Any help will be appreciated.
Thanks in advance.










share|improve this question























  • I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
    – fossfreedom♦
    Mar 17 at 11:20













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am writing an applet for Ubuntu Budgie in python.I wrote some code,debugged with no errors, saved it and put the folder with the files in ~/.local/share/budgie-desktop/plugin directory so I can add it on panel.I tried to add it as an applet but nothing happened.So I am not sure if is running smoothly or not.
The code is in this link



https://gist.github.com/cgiannakidis70/db0cf31558e6c20e95716679b831fd8f



#!/usr/bin/env python3

import os
import gi
import gi.repository
gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk, Gio

class myapplet(GObject.GObject, Budgie.Plugin):

__gtype_name__ = "myapplet"

def __int__(self):

GObject.GObject.__init__(self)

def do_get_panel_widged(self, uuid):

return myappletApplet(uuid)

class myappletApplet(Budgie.Applet):

def __init__(self, uuid):

Budgie.Applet.__init__(self)

self.button = Gtk.ToggleButton.new("A")
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
self.add(self.button)
self.button.connect("clicked", self.button_clicked)
self.show_all()

def button_clicked(self):

dialog = menu(self)
response = dialog.run()

dialog.destroy()

#Create Menu
menu = Gio.Menu()
menu.append("About This PC", "app.about_this_pc")
self.set_applet_menu(menu)

#create an action for the option "About This PC" of the menu
about_this_pc_action = Gio.SimpleAction.new("about_this_pc", None)
about_this_pc_action.connect("activate", self.about_this_pc_cb)
self.add_action(about_this_pc_action)



def about_this_pc_cb(self, action, parameter):

print("About This PC")




Gtk.main()


The applet is about a button in panel which every time i push it opens a dropdown menu with some options that can be activated.Like the "user-indicator-applet".



Right now I am stacked and I can not continue the code .Any help will be appreciated.
Thanks in advance.










share|improve this question















I am writing an applet for Ubuntu Budgie in python.I wrote some code,debugged with no errors, saved it and put the folder with the files in ~/.local/share/budgie-desktop/plugin directory so I can add it on panel.I tried to add it as an applet but nothing happened.So I am not sure if is running smoothly or not.
The code is in this link



https://gist.github.com/cgiannakidis70/db0cf31558e6c20e95716679b831fd8f



#!/usr/bin/env python3

import os
import gi
import gi.repository
gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk, Gio

class myapplet(GObject.GObject, Budgie.Plugin):

__gtype_name__ = "myapplet"

def __int__(self):

GObject.GObject.__init__(self)

def do_get_panel_widged(self, uuid):

return myappletApplet(uuid)

class myappletApplet(Budgie.Applet):

def __init__(self, uuid):

Budgie.Applet.__init__(self)

self.button = Gtk.ToggleButton.new("A")
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
self.add(self.button)
self.button.connect("clicked", self.button_clicked)
self.show_all()

def button_clicked(self):

dialog = menu(self)
response = dialog.run()

dialog.destroy()

#Create Menu
menu = Gio.Menu()
menu.append("About This PC", "app.about_this_pc")
self.set_applet_menu(menu)

#create an action for the option "About This PC" of the menu
about_this_pc_action = Gio.SimpleAction.new("about_this_pc", None)
about_this_pc_action.connect("activate", self.about_this_pc_cb)
self.add_action(about_this_pc_action)



def about_this_pc_cb(self, action, parameter):

print("About This PC")




Gtk.main()


The applet is about a button in panel which every time i push it opens a dropdown menu with some options that can be activated.Like the "user-indicator-applet".



Right now I am stacked and I can not continue the code .Any help will be appreciated.
Thanks in advance.







python gtk applet budgie






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 17 at 11:21









fossfreedom♦

146k34324368




146k34324368










asked Mar 14 at 23:11









cgiannakisis

305




305











  • I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
    – fossfreedom♦
    Mar 17 at 11:20

















  • I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
    – fossfreedom♦
    Mar 17 at 11:20
















I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
– fossfreedom♦
Mar 17 at 11:20





I have rolled back your edits because your question has effectively completely changed from your start point. Remember, please ask new questions e.g. "how do I display a popup menu". What we don't do is change the question all the time otherwise answers will not make much sense because the question has changed.
– fossfreedom♦
Mar 17 at 11:20











1 Answer
1






active

oldest

votes

















up vote
1
down vote













I spot a typo!



def do_get_panel_widged(self, uuid):


It should be:



def do_get_panel_widget(self, uuid):


What is happening is that the typo version is just defining a function. Implicitly do_get_panel_widget is being called but it is a stub function so the applet will never appear.



With the correct name - you are now overriding the inbuilt stub function and calling out to your new applet code.



Secondly in your example you are missing a .plugin file - you need this to allow the module to run. The plugin file is this format:



[Plugin]
Loader=python3
Module=test
Name=test
Description=test description
Authors=your name
Copyright=© 2018 email address
Website=https://your-website.com
Icon=we-prefer-symbolic-icons-symbolic


Thirdly:



Don't have a Gtk.main() at the end of you main module - that just confuses a Peas based plugin - delete it



Fourth:



Use a Gtk.EventBox() to add your applet in - it is how budgie-desktop 10.4 plugins should now be written - example code below



 self.button = Gtk.ToggleButton.new()
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
box = Gtk.EventBox()
box.add(self.button)
self.add(box)
self.button.connect("clicked", self.button_clicked)
box.show_all()
self.show_all()

def button_clicked(self, *args):


Fifth:



Notice the button_clicked event is missing an argument - clicked events in GTK pass the button itself to the signal handler



Lastly - which I havent corrected for you - your clicked function has an uninitialised dialog - and you appear to want to display a Gtk Dialog. Don't! You will block the main thread of the panel.






share|improve this answer






















  • Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
    – cgiannakisis
    Mar 15 at 11:16










  • ok - amended the answer - please review the changes I am suggesting.
    – fossfreedom♦
    Mar 15 at 11:37










  • I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
    – cgiannakisis
    Mar 15 at 12:26










  • @cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
    – fossfreedom♦
    Mar 15 at 12:40










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1015017%2fwhy-does-my-budgie-applet-not-display-in-the-budgie-panel%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













I spot a typo!



def do_get_panel_widged(self, uuid):


It should be:



def do_get_panel_widget(self, uuid):


What is happening is that the typo version is just defining a function. Implicitly do_get_panel_widget is being called but it is a stub function so the applet will never appear.



With the correct name - you are now overriding the inbuilt stub function and calling out to your new applet code.



Secondly in your example you are missing a .plugin file - you need this to allow the module to run. The plugin file is this format:



[Plugin]
Loader=python3
Module=test
Name=test
Description=test description
Authors=your name
Copyright=© 2018 email address
Website=https://your-website.com
Icon=we-prefer-symbolic-icons-symbolic


Thirdly:



Don't have a Gtk.main() at the end of you main module - that just confuses a Peas based plugin - delete it



Fourth:



Use a Gtk.EventBox() to add your applet in - it is how budgie-desktop 10.4 plugins should now be written - example code below



 self.button = Gtk.ToggleButton.new()
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
box = Gtk.EventBox()
box.add(self.button)
self.add(box)
self.button.connect("clicked", self.button_clicked)
box.show_all()
self.show_all()

def button_clicked(self, *args):


Fifth:



Notice the button_clicked event is missing an argument - clicked events in GTK pass the button itself to the signal handler



Lastly - which I havent corrected for you - your clicked function has an uninitialised dialog - and you appear to want to display a Gtk Dialog. Don't! You will block the main thread of the panel.






share|improve this answer






















  • Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
    – cgiannakisis
    Mar 15 at 11:16










  • ok - amended the answer - please review the changes I am suggesting.
    – fossfreedom♦
    Mar 15 at 11:37










  • I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
    – cgiannakisis
    Mar 15 at 12:26










  • @cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
    – fossfreedom♦
    Mar 15 at 12:40














up vote
1
down vote













I spot a typo!



def do_get_panel_widged(self, uuid):


It should be:



def do_get_panel_widget(self, uuid):


What is happening is that the typo version is just defining a function. Implicitly do_get_panel_widget is being called but it is a stub function so the applet will never appear.



With the correct name - you are now overriding the inbuilt stub function and calling out to your new applet code.



Secondly in your example you are missing a .plugin file - you need this to allow the module to run. The plugin file is this format:



[Plugin]
Loader=python3
Module=test
Name=test
Description=test description
Authors=your name
Copyright=© 2018 email address
Website=https://your-website.com
Icon=we-prefer-symbolic-icons-symbolic


Thirdly:



Don't have a Gtk.main() at the end of you main module - that just confuses a Peas based plugin - delete it



Fourth:



Use a Gtk.EventBox() to add your applet in - it is how budgie-desktop 10.4 plugins should now be written - example code below



 self.button = Gtk.ToggleButton.new()
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
box = Gtk.EventBox()
box.add(self.button)
self.add(box)
self.button.connect("clicked", self.button_clicked)
box.show_all()
self.show_all()

def button_clicked(self, *args):


Fifth:



Notice the button_clicked event is missing an argument - clicked events in GTK pass the button itself to the signal handler



Lastly - which I havent corrected for you - your clicked function has an uninitialised dialog - and you appear to want to display a Gtk Dialog. Don't! You will block the main thread of the panel.






share|improve this answer






















  • Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
    – cgiannakisis
    Mar 15 at 11:16










  • ok - amended the answer - please review the changes I am suggesting.
    – fossfreedom♦
    Mar 15 at 11:37










  • I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
    – cgiannakisis
    Mar 15 at 12:26










  • @cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
    – fossfreedom♦
    Mar 15 at 12:40












up vote
1
down vote










up vote
1
down vote









I spot a typo!



def do_get_panel_widged(self, uuid):


It should be:



def do_get_panel_widget(self, uuid):


What is happening is that the typo version is just defining a function. Implicitly do_get_panel_widget is being called but it is a stub function so the applet will never appear.



With the correct name - you are now overriding the inbuilt stub function and calling out to your new applet code.



Secondly in your example you are missing a .plugin file - you need this to allow the module to run. The plugin file is this format:



[Plugin]
Loader=python3
Module=test
Name=test
Description=test description
Authors=your name
Copyright=© 2018 email address
Website=https://your-website.com
Icon=we-prefer-symbolic-icons-symbolic


Thirdly:



Don't have a Gtk.main() at the end of you main module - that just confuses a Peas based plugin - delete it



Fourth:



Use a Gtk.EventBox() to add your applet in - it is how budgie-desktop 10.4 plugins should now be written - example code below



 self.button = Gtk.ToggleButton.new()
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
box = Gtk.EventBox()
box.add(self.button)
self.add(box)
self.button.connect("clicked", self.button_clicked)
box.show_all()
self.show_all()

def button_clicked(self, *args):


Fifth:



Notice the button_clicked event is missing an argument - clicked events in GTK pass the button itself to the signal handler



Lastly - which I havent corrected for you - your clicked function has an uninitialised dialog - and you appear to want to display a Gtk Dialog. Don't! You will block the main thread of the panel.






share|improve this answer














I spot a typo!



def do_get_panel_widged(self, uuid):


It should be:



def do_get_panel_widget(self, uuid):


What is happening is that the typo version is just defining a function. Implicitly do_get_panel_widget is being called but it is a stub function so the applet will never appear.



With the correct name - you are now overriding the inbuilt stub function and calling out to your new applet code.



Secondly in your example you are missing a .plugin file - you need this to allow the module to run. The plugin file is this format:



[Plugin]
Loader=python3
Module=test
Name=test
Description=test description
Authors=your name
Copyright=© 2018 email address
Website=https://your-website.com
Icon=we-prefer-symbolic-icons-symbolic


Thirdly:



Don't have a Gtk.main() at the end of you main module - that just confuses a Peas based plugin - delete it



Fourth:



Use a Gtk.EventBox() to add your applet in - it is how budgie-desktop 10.4 plugins should now be written - example code below



 self.button = Gtk.ToggleButton.new()
self.button.set_relief(Gtk.ReliefStyle.NONE)
self.button.set_active(False)
self.button.set_tooltip_text("Apple Menu")
box = Gtk.EventBox()
box.add(self.button)
self.add(box)
self.button.connect("clicked", self.button_clicked)
box.show_all()
self.show_all()

def button_clicked(self, *args):


Fifth:



Notice the button_clicked event is missing an argument - clicked events in GTK pass the button itself to the signal handler



Lastly - which I havent corrected for you - your clicked function has an uninitialised dialog - and you appear to want to display a Gtk Dialog. Don't! You will block the main thread of the panel.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 15 at 11:36

























answered Mar 15 at 10:53









fossfreedom♦

146k34324368




146k34324368











  • Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
    – cgiannakisis
    Mar 15 at 11:16










  • ok - amended the answer - please review the changes I am suggesting.
    – fossfreedom♦
    Mar 15 at 11:37










  • I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
    – cgiannakisis
    Mar 15 at 12:26










  • @cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
    – fossfreedom♦
    Mar 15 at 12:40
















  • Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
    – cgiannakisis
    Mar 15 at 11:16










  • ok - amended the answer - please review the changes I am suggesting.
    – fossfreedom♦
    Mar 15 at 11:37










  • I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
    – cgiannakisis
    Mar 15 at 12:26










  • @cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
    – fossfreedom♦
    Mar 15 at 12:40















Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
– cgiannakisis
Mar 15 at 11:16




Hi. Thank you for your reply.About the .plugin file, sorry i did not mention above.I have the .plugin file created and saved in the same folder with the .py file.I corrected the def of the function but I still can not add the applet .
– cgiannakisis
Mar 15 at 11:16












ok - amended the answer - please review the changes I am suggesting.
– fossfreedom♦
Mar 15 at 11:37




ok - amended the answer - please review the changes I am suggesting.
– fossfreedom♦
Mar 15 at 11:37












I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
– cgiannakisis
Mar 15 at 12:26




I made the changes you suggest.About the clicked function I replace dialog with menu .Is it ok this?
– cgiannakisis
Mar 15 at 12:26












@cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
– fossfreedom♦
Mar 15 at 12:40




@cgiannakisis this is really a new question - what you really want is to display a Gtk.Popover - or possibly a Gtk.PopoverMenu lazka.github.io/pgi-docs/#Gtk-3.0/classes/…
– fossfreedom♦
Mar 15 at 12:40

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1015017%2fwhy-does-my-budgie-applet-not-display-in-the-budgie-panel%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Which professions warranted travel in Medieval times?

How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

Trouble downloading packages list due to a “Hash sum mismatch” error