Active Topics

 


Reply
Thread Tools
Posts: 308 | Thanked: 62 times | Joined on Jun 2009 @ Turkiye
#1
hi everybody
i want to design some widgets with glade
but i dunno how to import them into this code:
Code:
import gtk
import hildondesktop
import os

class DesktopApplet(hildondesktop.HomeItem):

	def Button_clicked(self, Widget, Data = None):

		os.spawnlp(os.P_NOWAIT, "maemo-invoker", "maemo-invoker", "osso-xterm.launch")

	def __init__(self):

		hildondesktop.HomeItem.__init__(self)

		Button = gtk.Button()
		Image = gtk.image_new_from_file("/usr/share/icons/hicolor/64x64/apps/terminal.png")
		Button.set_image(Image)
		Button.connect("clicked", self.Button_clicked)
		Button.show()

		self.add(Button)


def hd_plugin_get_objects():
	plugin = DesktopApplet()
	return [plugin]
please help how can i integrate glade formatted design into this code?
 
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#2
Use GTKBuilder type project, not Glade (Glade requires external library).

http://www.micahcarrick.com/12-24-20...al-part-1.html
http://www.micahcarrick.com/12-27-20...al-part-2.html
http://www.micahcarrick.com/01-01-20...al-part-3.html

Something like this /taken from the tutorial/:
Code:
#!/usr/bin/env python
 
# First run tutorial.glade through gtk-builder-convert with this command:
# gtk-builder-convert tutorial.glade tutorial.xml
# Then save this file as tutorial.py and make it executable using this command:
# chmod a+x tutorial.py
# And execute it:
# ./tutorial.py
 
import pygtk
pygtk.require("2.0")
import gtk
 
class TutorialApp(object):       
  def __init__(self):
      builder = gtk.Builder()
      builder.add_from_file("tutorial.xml")
      builder.connect_signals({ "on_window_destroy" : gtk.main_quit })
      self.window = builder.get_object("window")
      self.window.show()
 
if __name__ == "__main__":
  app = TutorialApp()
  gtk.main()
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.
 

The Following User Says Thank You to Bundyo For This Useful Post:
Posts: 308 | Thanked: 62 times | Joined on Jun 2009 @ Turkiye
#3
thank you so much

but i got a lil trouble on converting glade to xml on windows machine?
:/

Last edited by McLightning; 2009-12-29 at 13:29.
 
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#4
What I meant was - use Glade 3, but start with GTKBuilder project from the beginning then save it and import it.
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.
 

The Following User Says Thank You to Bundyo For This Useful Post:
Posts: 308 | Thanked: 62 times | Joined on Jun 2009 @ Turkiye
#5
the version of my glade is 3.6.6 and i started with gtkbuilder not libglade
then when i save it, it is automatically naming it as *.glade
should i rename it to xml manually by myself??
ok it worked
thanx bundyo

Last edited by McLightning; 2009-12-30 at 13:07.
 

The Following User Says Thank You to McLightning For This Useful Post:
Posts: 308 | Thanked: 62 times | Joined on Jun 2009 @ Turkiye
#6
by the way my question is not solved yet
what i meant is hildondesktop and glade together in a script.
 
Reply


 
Forum Jump


All times are GMT. The time now is 23:12.