Ejemplo n.º 1
0
def initAndRun():
    """
    start up gui
    """
    elementary.init()
    MainWindow()
    elementary.run()
    elementary.shutdown()
Ejemplo n.º 2
0
 def __init__(self):
     self.dbus_loop = e_dbus.DBusEcoreMainLoop()
     try:
         elementary.c_elementary.theme_overlay_add(
             "/usr/share/elementary/themes/paroli.edj")
     except:
         logger.info(
             "can't add elementary theme overlay, please update your bindings"
         )
     elementary.init()
Ejemplo n.º 3
0
 def __init__(self):
     self.usingMetric = False
     self.seaLevelPressure = 0
     self.altitudeLock = Lock()
     self.pressureLock = Lock()
     self.configfile = os.path.expanduser("~/.barom.cfg")
     # print "Attempting to load config"
     self.config = ConfigParser.SafeConfigParser()
     self.LoadConfig(self.configfile)
     # print "loaded config"
     self.widgets = self.build_gui()
     # print "built gui succesfully"
     self.widgets["mainwin"].show()
     elementary.init()
     elementary.run()
     elementary.shutdown()
Ejemplo n.º 4
0
 def __init__(self):
     self.usingMetric = False
     self.seaLevelPressure = 0
     self.altitudeLock = Lock()
     self.pressureLock = Lock()
     self.configfile = os.path.expanduser('~/.barom.cfg')
     #print "Attempting to load config"
     self.config = ConfigParser.SafeConfigParser()
     self.LoadConfig(self.configfile)
     #print "loaded config"
     self.widgets = self.build_gui()
     #print "built gui succesfully"
     self.widgets['mainwin'].show()
     elementary.init()
     elementary.run()
     elementary.shutdown()
Ejemplo n.º 5
0
	def __init__ (self):
		self.brands = []
		self.enabledBrands = {}
		self.usingCelsius = 0
		self.usingSensor = 0
		self.sensorTemperature = 1
		self.LoadDB()
		self.configfile = os.path.expanduser ('~/.wax-chooser.cfg')
		self.config = ConfigParser.SafeConfigParser ()
		self.LoadConfig (self.configfile)
		self.widgets = self.build_gui ()
		self.sensorTimer = ecore.timer_add( 1, self.updateSensorLabel )
		self.image_path = './'
		self.widgets['mainwin'].show ()
		self.snow_cond = 0
		self.humidity = 1
		self.bestAveTemp = 9999
		signal.signal(signal.SIGINT, self.interrupted)

		elementary.init()                            
                                               
		elementary.run()                                            
		elementary.shutdown()           
Ejemplo n.º 6
0
    def __init__(self, p):
        self.parent = p
        self.petid = -1
        elementary.init()
        self.win = elementary.Window('geekogotchi', elementary.ELM_WIN_BASIC)
        self.win.title_set('Geekogotchi')
        bg = elementary.Background(self.win)
        bg.show()
        self.win.resize_object_add(bg)
        self.win.callback_destroy_add(self.windowClose)
        frame = elementary.Frame(self.win)
        box = elementary.Box(self.win)
        frame.content_set(box)
        frame.show()
        self.win.resize_object_add(frame)
        box.show()

        self.age = elementary.Label(self.win)
        box.pack_start(self.age)
        self.age.show()

        self.state = elementary.Label(self.win)
        box.pack_end(self.state)
        self.state.show()

        self.values = elementary.Box(self.win)
        self.values.show()
        box.pack_end(self.values)

        self.health = elementary.Label(self.win)
        self.values.pack_end(self.health)
        self.health.show()

        self.hungry = elementary.Label(self.win)
        self.values.pack_end(self.hungry)
        self.hungry.show()

        self.happy = elementary.Label(self.win)
        self.values.pack_end(self.happy)
        self.happy.show()

        self.buttons = elementary.Box(self.win)
        self.buttons.horizontal_set(True)
        self.buttons.homogenous_set(True)
        box.pack_end(self.buttons)
        self.buttons.show()

        self.feed = elementary.Button(self.win)
        self.feed.label_set('Feed')
        self.feed._callback_add('clicked', self.feedPet)
        self.buttons.pack_end(self.feed)
        self.feed.show()

        self.heal = elementary.Button(self.win)
        self.heal.label_set('Heal')
        self.heal._callback_add('clicked', self.healPet)
        self.buttons.pack_end(self.heal)
        self.heal.show()

        self.play = elementary.Button(self.win)
        self.play.label_set('Play')
        self.play._callback_add('clicked', self.playWithPet)
        self.buttons.pack_end(self.play)
        self.play.show()

        self.remove = elementary.Button(self.win)
        self.remove.label_set('Remove')
        self.remove._callback_add('clicked', self.removePet)
        box.pack_end(self.remove)
Ejemplo n.º 7
0
    def __init__(self):
#            print spoje.KODOVANI_SYSTEM
            self.database = database()
            self.idos = spoje.IDOS()
            

#            odkudText = "Jablonec" 
#            kamText = "Praha"

                        
            self.typySpoju = spoje.IDOS().TYPY_SPOJU
#            self.typSpoje = self.typySpoju[0]
            self.typSpoje = self.database.getTyp()
            elementary.init() 
            
            self.win = elementary.Window("spoje-gui", elementary.ELM_WIN_BASIC)
            self.win.title_set("Spoje GUI")
            #win.autodel_set(True) ## window manageru uvoznuje zavreni okna, ale skript porad bezi dal    
            self.win.callback_destroy_add(self.destroy)  
            ##window manageru umozni zavreni  programu
              
            
            bg = elementary.Background(self.win)
            self.win.resize_object_add(bg)
            bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
            bg.show()
 

        ##################  SCROLOVANI #################
        
            self.pager = elementary.Pager(self.win)
            self.pager.show()
        
            scroller = elementary.Scroller(self.win)
            scroller.show()
            scroller.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
            scroller.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
           

            self.win.resize_object_add(self.pager)
            
            self.pageMain=scroller


            self.box = elementary.Box(self.win)
            self.box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
            self.box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)       
            self.box.show()
            
            scroller.content_set(self.box)

                    
            ########## VYPLNENI OKNA POLOZKAMI
            self.fillTypSpoje()
            self.fillMisto()
            self.fillCasDatum()
            self.fillTlacitka()
            self.fillPoznamka()
            self.fillNastaveni()   
            ################### showData      ################
            #musi bej na konci aby se zobrazovalo navrchu
            self.showData=showData(self.win,self.pageMain,self.pager);
            self.pager.content_push(self.showData)

            ######
            self.pager.content_push( self.pageMain)
            ########### ZAVERECNE ZOBRAZENI
            self.win.show() 
    
            elementary.run()
            elementary.shutdown()
Ejemplo n.º 8
0
def main ():
	elementary.init()
	showmap()
	elementary.run()
	elementary.shutdown()
	return 0
    def makeGui(self,  modulesList, bus):
        

        D("ModulesWindow makeGui")
        elementary.init()
        D("ModulesWindow makeGui elementary.init")
        from shr_settings_modules import shr_gsm, shr_device_timeouts,shr_pm, shr_bt, shr_wifi, shr_gprs, shr_usb, shr_clock, shr_profile, shr_services, shr_misc, shr_test
        D("ModulesWindow makeGui from shr_settings_modules")

        self.win2 = elementary.Window("settingsMods", elementary.ELM_WIN_BASIC)
        self.win2.title_set(modulesList[0])
        self.win2.destroy = self.destroy2
        

        self.bg2 = elementary.Background(self.win2)
        self.win2.resize_object_add(self.bg2)
        self.bg2.size_hint_weight_set(1.0, 1.0)
        self.bg2.show()


        box02 = elementary.Box(self.win2)
        box02.size_hint_weight_set(1.0, 1.0)
        self.win2.resize_object_add(box02)
        box02.show()



    #    toolbar = elementary.Toolbar(win)
    #    box0.pack_start(toolbar)
    #    toolbar.show()

        sc2 = elementary.Scroller(self.win2)
        sc2.size_hint_weight_set(1.0, 1.0)
        sc2.size_hint_align_set(-1.0, -1.0)
        box02.pack_end(sc2)
        sc2.show()

        quitbt2 = elementary.Button(self.win2)
        quitbt2.clicked = self.destroy2
        quitbt2.label_set("Quit")
        quitbt2.size_hint_align_set(-1.0, 0.0)
        quitbt2.show()
        box02.pack_end(quitbt2)


        box12 = elementary.Box(self.win2)
        box12.size_hint_weight_set(1.0, -1.0)
        sc2.content_set(box12)
        box12.show()

        D("ModulesWindow makeGui gui")

        D("ModulesWindow makeGui gui mod for")
        self.modList = []
        for mod in modulesList[2]:
        
            print "loading %s" % mod
            try:
                mod2 = mod(self.win2, bus)
                self.modList.append(mod2)

                if mod2.isEnabled():
                    cont = mod2.createView()

                    frame = elementary.Frame(self.win2)

                    frame.label_set(mod2.getName()+" settings")
                    box12.pack_end(frame)
                    frame.size_hint_align_set(-1.0, 0.0)
                    frame.show()

                    if cont != None:
                        frame.content_set(cont)
                        cont.show()
                    else:
                        print " error! module %s method createView() return's nothing!" % mod2
            except:
                print "module %s can't be loaded!" % mod
		D("ModulesWindow makeGui gui mod for done")

        self.win2.show()
Ejemplo n.º 10
0
def __init__():
    elementary.init()

    win = elementary.Window("c_c", elementary.ELM_WIN_BASIC)
    win.title_set("gift to c_c")
    win.destroy = (destroy, ("test", "test1"))
    
    ly = elementary.Layout(win)
    ly.file_set("gui.edj", "Intone")
    win.resize_object_add(ly)
    ly.show()
    
    global scroller1
    scroller1 = elementary.Scroller(win)
    scroller1.size_hint_weight_set(1.0, 1.0)
    scroller1.size_hint_align_set(-1.0, -1.0)
    scroller1.bounce_set(0, 0)
    scroller1.show()
    
    textbox1 = elementary.Entry(win)
    textbox1.single_line_set(True)
    textbox1.entry_set("Textbox 1")
    
    textbox1.size_hint_weight_set(1.0, 1.0)
    textbox1.size_hint_align_set(-1.0, -1.0)
    textbox1.scale_set(1.8)
    textbox1.show()
    textbox1.on_mouse_down_add(textbox_mouse_down)

    
    scroller1.content_set(textbox1)
    scroller1.show()
    
    global scroller2
    scroller2 = elementary.Scroller(win)
    scroller2.size_hint_weight_set(1.0, 1.0)
    scroller2.size_hint_align_set(-1.0, -1.0)
    scroller2.bounce_set(0, 0)
    scroller2.show()
    
    textbox2 = elementary.Entry(win)
    textbox2.entry_set("Textbox2")
    
    textbox2.scale_set(3)
    textbox2.size_hint_weight_set(1.0, 1.0)
    textbox2.size_hint_align_set(-1.0, -1.0)
    
    textbox2.show()
    textbox2.on_mouse_down_add(textbox_mouse_down)
    
    scroller2.content_set(textbox2)
        
    ly.content_set('vbox1_swallow', scroller1)
    ly.content_set('vbox1b_swallow', scroller2)    
    
    win.resize(480, 640-64) # without illume keyboard
    win.show()


    ecore.idler_add(_auto_hide)
    return
Ejemplo n.º 11
0
            for x in label:
                lst.item_append("            %s" %x)
        elif "<SEP>" in label or label == " ":
            sep = lst.item_append(" ")
            sep.separator_set(True)
        elif child:
            lst.item_append(" -" + label)
        else:
            lst.item_append(label)

    def size_hints(self, item, weight=False, align=False):
        if weight:
            item.size_hint_weight_set(weight[0], weight[1])
        else:
            item.size_hint_weight_set(1.0, 1.0)
        if align:
            item.size_hint_align_set(align[0], align[1])
        else:
            item.size_hint_align_set(-1.0, -1.0)


#---Start

if __name__ == "__main__":
    elm.init()

    eInfo()

    elm.run()
    elm.shutdown()
Ejemplo n.º 12
0
 def __init__(self, amsn_core):
     elementary.init()
Ejemplo n.º 13
0
	def build_gui (self):

		def destroy (obj, *args, **kargs):
			
			self.sensorTimer.delete()
			self.SaveConfig (self.configfile)
			elementary.exit ()

		gui_items = dict ()

		# Start elementary
		elementary.init ()

		# Create main window
		gui_items['mainwin'] = elementary.Window ("Wax-Chooser", elementary.ELM_WIN_BASIC)
		gui_items['mainwin'].title_set ("Wax-Chooser")
		gui_items['mainwin'].callback_destroy_add (destroy)

		# Create background
		bg = elementary.Background (gui_items['mainwin'])
		bg.size_hint_weight_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		bg.size_hint_min_set (200,300)
		gui_items['mainwin'].resize_object_add (bg)
		bg.show ()

		# Create main box (vertical by default)
		gui_items['mainbox'] = elementary.Box (gui_items['mainwin'])
		gui_items['mainbox'].size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		gui_items['mainbox'].size_hint_align_set (-1.0, evas.EVAS_HINT_FILL)
		gui_items['mainwin'].resize_object_add (gui_items['mainbox'])
		gui_items['mainbox'].show ()

		# Create title label
		gui_items['title'] = elementary.Label (gui_items['mainwin'])
		gui_items['title'].text_set ("Current Conditions")
		gui_items['mainbox'].pack_start (gui_items['title'])
		gui_items['title'].size_hint_weight_set (1.0, evas.EVAS_HINT_FILL)
		gui_items['title'].size_hint_align_set (0.5, -1.0)
		gui_items['title'].show ()

		# Create scroller to hold condition descripion items
		self.sc2 = elementary.Scroller(gui_items['mainwin'])
		self.sc2.bounce_set(0, 0)
		self.sc2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 1.0)
		self.sc2.size_hint_align_set(-1.0, evas.EVAS_HINT_FILL)
		gui_items['mainbox'].pack_end(self.sc2)
		self.sc2.show()
		gui_items['mainwin'].resize_object_add (self.sc2)
		
		# Create condtion description box (vertical by default)
		box2 = elementary.Box (gui_items['mainwin'])
		box2.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		box2.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		self.sc2.content_set (box2)
		box2.show ()
		

		gui_items['rows'] = []
		
		# Create four boxes: temperature, humidity, snow type, and buttons, set as horizonal
		tbox = elementary.Box (gui_items['mainwin'])
		#tbox.horizontal_set (1)
		#box1.homogenous_set (1)
		tbox.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		tbox.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		box2.pack_end (tbox)
		tbox.show ()
		
		# Create temperature widget label
		
		tl = elementary.Label (gui_items['mainwin'])
		tl.text_set ('Temperature')
		tbox.pack_start( tl )
		tl.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		tl.size_hint_align_set (0.4, 0.5)
		tl.show ()
						
		# Create temperature slider
		gui_items['temperatureSlider'] = elementary.Slider (gui_items['mainwin'])
		gui_items['temperatureSlider'].size_hint_weight_set (1, 0)
		gui_items['temperatureSlider'].size_hint_align_set (-1, 0)
		if self.usingCelsius:
			gui_items['temperatureSlider'].min_max_set (-30.0, 10.0)
			gui_items['temperatureSlider'].value = 0
		else:
			gui_items['temperatureSlider'].min_max_set (-15.0, 45.0)
			gui_items['temperatureSlider'].value = 32
		gui_items['temperatureSlider'].unit_format_set( '%1.1f degrees' )
		tbox.pack_end (gui_items['temperatureSlider'])
		gui_items['temperatureSlider'].show ()
		
		
		tsbox = elementary.Box (gui_items['mainwin'])
		tsbox.horizontal_set (1)
		tsbox.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		tsbox.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		box2.pack_end (tsbox)
		tsbox.show ()

		# Create Use Sensor button
		gui_items['sensorButton'] = elementary.Button (gui_items['mainwin'])
		gui_items['sensorButton']._callback_add ('clicked', self.setTemperatureFromSensor)
		ic = elementary.Icon(gui_items['sensorButton'])
		ic.file_set(os.path.join(IMAGE_DIR, "thermometer.png"))
		gui_items['sensorButton'].icon_set( ic)
		gui_items['sensorButton'].text_set( "Searching for sensor" )
		gui_items['sensorButton'].size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		gui_items['sensorButton'].size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		
		tsbox.pack_end (gui_items['sensorButton'])
		if self.usingSensor:
			gui_items['sensorButton'].show ()
		
		######## Humidity ############		
		hbox = elementary.Box (gui_items['mainwin'])
		#box1.homogenous_set (1)
		hbox.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		hbox.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		box2.pack_end (hbox)
		hbox.show ()
		gui_items['mainwin'].resize_object_add (hbox)
		
		#create humidity widget label
		hl = elementary.Label (gui_items['mainwin'])
		hl.text_set ('Humidity')
		hl.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		hl.size_hint_align_set (0.45, 0.5)
		hbox.pack_start (hl)		
		hl.show ()
		
		hbox2 = elementary.Box (gui_items['mainwin'])
		hbox2.horizontal_set (1)
		#box1.homogenous_set (1)
		hbox2.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		hbox2.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		hbox.pack_end (hbox2)
		gui_items['mainwin'].resize_object_add (hbox2)
		hbox2.show ()	
		
		#Create humidity toolbar
		rhtoolbar = elementary.Toolbar(gui_items['mainwin'])
		rhtoolbar.menu_parent_set(gui_items['mainwin'])
		rhtoolbar.homogenous_set(0)		
		rhtoolbar.icon_size_set( 64 )		
	#	print str( rhtoolbar.icon_size )
		rhtoolbar.icon_size = ( 96 )		
	#	print str( rhtoolbar.icon_size )
		
		rhtoolbar.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)                                                            
		rhtoolbar.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		rhtoolbar.item_append(os.path.join(IMAGE_DIR, 'medrh.png'), "Normal", self.setHumidity,humidity=NORMAL_HUMIDITY)
		rhtoolbar.item_append(os.path.join(IMAGE_DIR, 'highrh.png'), "High", self.setHumidity,humidity=HIGH_HUMIDITY)
		rhtoolbar.first_item_get().selected_set(True)
		hbox2.pack_end( rhtoolbar )
		rhtoolbar.show()
		
		
		######## Snow Condition ############		
		sbox = elementary.Box (gui_items['mainwin'])
		#box1.homogenous_set (1)
		sbox.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		sbox.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		box2.pack_end (sbox)
		sbox.show ()
		
		
		#create snow cond widget label
		sl = elementary.Label (gui_items['mainwin'])
		sl.text_set ('Snow Condition')
		sl.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		sl.size_hint_align_set (0.45, 0.5)
		sbox.pack_start (sl)		
		sl.show ()
		
		sbox2 = elementary.Box (gui_items['mainwin'])
		sbox2.horizontal_set (1)
		#box1.homogenous_set (1)
		sbox2.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		sbox2.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		sbox.pack_end (sbox2)
		sbox2.show ()	
		
		#Create Snow condition toolbar
		sctoolbar = elementary.Toolbar(gui_items['mainwin'])
		sctoolbar.menu_parent_set(gui_items['mainwin'])
		sctoolbar.homogenous_set(0)
		sctoolbar.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)                                                            
		sctoolbar.size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		sctoolbar.item_append(os.path.join(IMAGE_DIR, 'newsnow.png'), "New", self.setSnowCond,snowcond=NEW_SNOW)
		sctoolbar.item_append(os.path.join(IMAGE_DIR, 'transformedsnow.png'), "Transformed", self.setSnowCond,snowcond=OLD_SNOW)
		sctoolbar.item_append(os.path.join(IMAGE_DIR, 'corn.png'), "Corn", self.setSnowCond,snowcond=CORN_SNOW)
		sctoolbar.item_append(os.path.join(IMAGE_DIR, 'ice.png'), "Ice", self.setSnowCond,snowcond=ICY_SNOW)
		sctoolbar.first_item_get().selected_set(True)		
		sbox2.pack_end( sctoolbar )
		sctoolbar.show()
			
		# Create bottom button row (prev, next city & refresh)
		box3 = elementary.Box (gui_items['mainwin'])
		box3.horizontal_set (1)
		box3.homogenous_set (1)
		box3.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		box3.size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		gui_items['mainbox'].pack_end (box3)
		box3.show ()

		# Find Wax button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Find Wax')
		bt._callback_add ('clicked', self.find_wax)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		# Add a prev icon to the button
		box3.pack_end (bt)
		bt.show ()

		# Settings button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Settings')
		bt._callback_add ('clicked', self.settingsDialog)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		# Add a next icon to the button
		box3.pack_end (bt)
		bt.show ()

		
		#####
		# Create wax display box (vertical by default)
		gui_items['waxbox'] = elementary.Box (gui_items['mainwin'])
		gui_items['waxbox'].size_hint_weight_set (evas.EVAS_HINT_FILL, 1.0)
		gui_items['waxbox'].size_hint_align_set (evas.EVAS_HINT_FILL, -1.0)
		gui_items['waxLabel'] = elementary.Label(gui_items['mainwin'])
		gui_items['waxLabel'].text_set("Wax")
		gui_items['waxbox'].pack_start(gui_items['waxLabel'])
		gui_items['waxLabel'].show()
		# Create box to hold the wax picture
	
		sc = elementary.Scroller(gui_items['waxbox'])
		sc.bounce_set(0, 0)
		sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.5)
		sc.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		
		
		ib = elementary.Box(gui_items['mainwin'])
		ib.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.5)
		ib.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
		gui_items['waxicon'] = elementary.Icon(gui_items['mainwin'])
		gui_items['waxicon'].size_hint_weight_set(1.0, 0.5)
		gui_items['waxicon'].scale_set(0.2, 0.2)
		gui_items['waxicon'].size_hint_align_set(0.5, 0.0)
		ib.pack_end(gui_items['waxicon'])
		gui_items['mainwin'].resize_object_add (ib)
		
		gui_items['waxicon'].show()
		
		gui_items['waxtext'] = elementary.Entry( gui_items['mainwin'] )
		gui_items['waxtext'].size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		gui_items['waxtext'].size_hint_align_set(-1.0, 0.0)
		gui_items['waxtext'].scale_set(1)
		ib.pack_end(gui_items['waxtext'])
		gui_items['waxtext'].show()
		sc.content_set(ib)
		gui_items['waxbox'].pack_end(sc)
		gui_items['mainwin'].resize_object_add (sc)
		ib.show()
		sc.show()
		
		# Create bottom button row (warmer back colder)
		box3 = elementary.Box (gui_items['mainwin'])
		box3.horizontal_set (1)
		box3.homogenous_set (1)
		box3.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		box3.size_hint_align_set (evas.EVAS_HINT_FILL, 1.0)
		gui_items['waxbox'].pack_end (box3)
		box3.show ()
		gui_items['mainwin'].resize_object_add (box3)
		
		# Create the warmer button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Warmer')
		bt._callback_add ('clicked', self.warmerWax)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		box3.pack_end (bt)
		bt.show ()

		# Create the back button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Back')
		bt._callback_add ('clicked', self.closeWax)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		box3.pack_end (bt)
		bt.show ()
		
		# Create the Colder button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Colder')
		bt._callback_add ('clicked', self.colderWax)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		box3.pack_end (bt)
		bt.show ()
		
		gui_items['mainwin'].resize_object_add (gui_items['waxbox'])
		gui_items['waxbox'].hide ()
		
		#####
		# Create about box (vertical by default)
		gui_items['aboutbox'] = elementary.Box (gui_items['mainwin'])
		gui_items['aboutbox'].size_hint_weight_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		gui_items['aboutbox'].size_hint_align_set (-1.0, -1.0)
		al = elementary.Label(gui_items['mainwin'])
		al.size_hint_weight_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		al.size_hint_align_set (0.5, -1.0)
		al.text_set("About waxChooser")
		gui_items['aboutbox'].pack_start(al)
		al.show()
		sc2 = elementary.Scroller(gui_items['mainwin'])
		sc2.bounce_set(0, 0)
		sc2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 1.0)
		sc2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		gui_items['aboutbox'].pack_end(sc2)
		gui_items['mainwin'].resize_object_add (sc2)
		sc2.show()

		ib =    elementary.Box(gui_items['aboutbox'])
		ic = elementary.Icon(gui_items['aboutbox'])
		ic.size_hint_weight_set(evas.EVAS_HINT_FILL,1.0)
		ic.scale_set(0, 0) 
		ic.size_hint_align_set(0.5, 0.5)
		gui_items['mainwin'].resize_object_add(ic)
		ic.file_set(os.path.join(IMAGE_DIR, "author.png"))
		ib.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		ib.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		ib.pack_end(ic)
		sc2.content_set(ib)

		ic.show()
		gui_items['mainwin'].resize_object_add (ic)
		
		# Create text box with 'about' info
		at = elementary.Entry( gui_items['mainbox'] )
		at.size_hint_weight_set(1.0, 0.0)
		at.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
		at.scale_set(1)
		info = self.infoadd("waxChooser " + APP_VERSION)
		info += self.infoadd("Copyright (c) 2011 Benjamin Deering")
		info += self.infoadd("<*****@*****.**>" )
		at.text_set( info )	
		gui_items['aboutbox'].pack_end(at)
		at.show()
		
		# Create bottom button row (back, about)
		box3 = elementary.Box (gui_items['mainwin'])
		box3.horizontal_set (1)
		box3.homogenous_set (1)
		box3.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		box3.size_hint_align_set (-1.0, 0.0)
		gui_items['aboutbox'].pack_end (box3)
		box3.show ()
		# Create the back button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Back')
		bt._callback_add ('clicked', self.hideAbout)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, -1.0)
		box3.pack_end (bt)
		bt.show ()
		
		gui_items['mainwin'].resize_object_add (gui_items['aboutbox'])
		
		#####
		# Create settings box (vertical by default)
		gui_items['settingsbox'] = elementary.Box (gui_items['mainwin'])
		gui_items['settingsbox'].size_hint_weight_set (evas.EVAS_HINT_EXPAND, 1.0)
		gui_items['settingsbox'].size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		settingsLabel = elementary.Label(gui_items['mainwin'])
		settingsLabel.text_set('Settings')
		settingsLabel.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		settingsLabel.size_hint_align_set (0.5, -1.0)
		gui_items['settingsbox'].pack_start( settingsLabel)
		settingsLabel.show()	
		
		# Create scroller to hold settings toggles items
		sc2 = elementary.Scroller(gui_items['mainwin'])
		sc2.bounce_set(0, 0)
		sc2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 1.0)
		sc2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
		gui_items['settingsbox'].pack_end(sc2)
		gui_items['mainwin'].resize_object_add (sc2)
		sc2.show()
		
		tb = 	elementary.Box(gui_items['settingsbox'])
		
		
		ut = elementary.Check (gui_items['mainwin'])
		ut.text_set('Units')
		ut.style_set("toggle")
		ut.text_part_set( 'off', 'Fahrenheit' )
		ut.text_part_set( 'on', 'Celsius' )
		ut.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		ut.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		tb.pack_end( ut )
		ut.state_set(self.usingCelsius)
		ut._callback_add('changed',self.setUnits)
		ut.show()
		
		for brand in self.brands:
			ut = elementary.Check (gui_items['mainwin'])
			ut.style_set("toggle")
			ut.text_set(brand)
			ut.text_part_set( 'on', 'enabled' )
			ut.text_part_set( 'off', 'disabled' )   
			ut.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
			ut.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
			ut.state_set(eval(self.enabledBrands[brand]))
			tb.pack_end( ut )
			ut._callback_add('changed',self.enableBrands,brand=brand)
			ut.show()

		ut = elementary.Check (gui_items['mainwin'])
		ut.text_set('Use MLX90614')
		ut.style_set("toggle")
		ut.text_part_set( 'on', 'Yes' )
		ut.text_part_set( 'off', 'No' )  
		ut.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		ut.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		tb.pack_end( ut )
		ut.state_set(self.usingSensor)
		ut._callback_add('changed',self.setSensor)
		ut.show()
		tb.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		tb.size_hint_align_set (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)		
		tb.show()	
		#gui_items['settingsbox'].pack_end( tb )	
		sc2.content_set(tb)
		# Create bottom button row (back, about)
		box3 = elementary.Box (gui_items['mainwin'])
		box3.horizontal_set (1)
		box3.homogenous_set (1)
		box3.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		box3.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		gui_items['settingsbox'].pack_end (box3)
		box3.show ()
			
		# Create the back button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('Back')
		bt._callback_add ('clicked', self.closeSettings)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		box3.pack_end (bt)
		bt.show ()
		
		# Create the about button
		bt = elementary.Button (gui_items['mainwin'])
		bt.text_set ('About')
		bt._callback_add ('clicked', self.showAbout)
		bt.size_hint_weight_set (evas.EVAS_HINT_EXPAND, 0.0)
		bt.size_hint_align_set (evas.EVAS_HINT_FILL, 0.0)
		box3.pack_end (bt)
		bt.show ()
		
		
		#self.widgets['settingsbox'].pack_start(settingsTitle)	
		gui_items['mainwin'].resize_object_add (gui_items['settingsbox'])
		gui_items['settingsbox'].hide ()
		
		
		return gui_items
Ejemplo n.º 14
0
    bt = elementary.Button(win)
    bt.text_set("Button 1")
    ly.part_content_set("element1", bt)
    bt.elm_event_callback_add(_event)
    bt.elm_event_callback_del(_event)
    bt.show()

    bt = elementary.Button(win)
    bt.text_set("Button 2")
    ly.part_content_set("element2", bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text_set("Button 3")
    ly.part_content_set("element3", bt)
    bt.show()

    win.show()
# }}}

#----- Main -{{{-
if __name__ == "__main__":
    elementary.init()

    layout_clicked(None)

    elementary.run()
    elementary.shutdown()
# }}}
# vim:foldmethod=marker
    def __init__(self):
        D("MainWindow __init__")
        elementary.init()
        D("MainWindow __init__ elementary.init")
        self.win = elementary.Window("settings", elementary.ELM_WIN_BASIC)
        self.win.title_set("Settings")
        self.win.destroy = self.destroy


        D("MainWindow __init__ mainloop e_dbus")
        #dbus init:
        mainloop = e_dbus.DBusEcoreMainLoop()
        #dbus_session = dbus.SessionBus(mainloop=self.mainloop) - we don't need atm
        self.dbus_system = dbus.SystemBus(mainloop=mainloop)
        D("MainWindow __init__ dbus present")

        self.m = ModulesWindow()

        self.bg = elementary.Background(self.win)
        self.win.resize_object_add(self.bg)
        self.bg.size_hint_weight_set(1.0, 1.0)
        self.bg.show()

        box0 = elementary.Box(self.win)
        box0.size_hint_weight_set(1.0, 1.0)
        self.win.resize_object_add(box0)
        box0.show()



    #    toolbar = elementary.Toolbar(win)
    #    box0.pack_start(toolbar)
    #    toolbar.show()

        sc = elementary.Scroller(self.win)
        sc.size_hint_weight_set(1.0, 1.0)
        sc.size_hint_align_set(-1.0, -1.0)
        box0.pack_end(sc)
        sc.show()

        quitbt = elementary.Button(self.win)
        quitbt.clicked = self.destroy
        quitbt.label_set("Quit")
        quitbt.size_hint_align_set(-1.0, 0.0)
        quitbt.show()
        box0.pack_end(quitbt)

        box1 = elementary.Box(self.win)
        box1.size_hint_weight_set(1.0, -1.0)
        sc.content_set(box1)
        box1.show()

        #loading modules
        D("MainWindow __init__ gui")
        from shr_settings_modules import shr_gsm,shr_sim, shr_device_timeouts,shr_pm, shr_bt, shr_wifi, shr_gprs, shr_usb, shr_clock, shr_profile, shr_services, shr_misc, shr_test
        D("MainWindow __init__ after from import")

        dirs = [    ["GSM","ico_gsm_32_32.png",                        [ shr_gsm.Gsm, shr_sim.Sim ] ],
                    ["Bluetooth","ico_bt_32_32.png",                   [ shr_bt.Bt ] ],
                    ["Internet","ico_internet_32_32.png",              [ shr_wifi.Wifi, shr_gprs.Gprs ] ],
                    ["Profiles","ico_profile_32_32.png",               [ shr_profile.Profile ] ],
                    ["Clock","ico_timeset_32_32.png",                  [ shr_clock.Clock ] ],
                    ["Power management","ico_powermanager_32_32.png",  [ shr_pm.Pm , shr_device_timeouts.Timeouts ] ],
                    ["USB","ico_usb_32_32.png",                        [ shr_usb.Usb ] ],
                    ["Services","ico_initd_32_32.png",                 [ shr_services.Services ] ],
                    ["Others", "ico_others_32_32.png",                 [ shr_misc.Misc, shr_test.Test ] ]
            ]
            

        D("MainWindow __init__ before for")
        for d in dirs:
            bt = Button2(self.win)
            bt.set_modules( d )

            bt.clicked = self.displayModulesWin
            bt.size_hint_align_set(-1.0, 0.0)
            bt.label_set( str(d[0]) )
            bt.show()


            try:
                f = open("data/icons/"+str(d[1]), "r")
                ic = elementary.Icon(self.win)
                ic.file_set("data/"+str(d[1]) )
                ic.resizable_set(0, 0)
                bt.icon_set(ic)
                ic.show()

            except:
                try:
                    f = open("/usr/share/pixmaps/"+str(d[1]), "r")
                    ic = elementary.Icon(self.win)
                    ic.file_set("/usr/share/pixmaps/"+str(d[1]) )
                    ic.resizable_set(0, 0)
                    bt.icon_set(ic)
                    ic.show()
                except:
                    bt.label_set( str(d[0]) )

            box1.pack_end(bt)


        D("MainWindow __init__ after for")

        #for mod in modules:
        #    print "loading %s" % mod
        #    load_module(mod, win, dbus_system)

        #end of loading modules



        self.win.show()
Ejemplo n.º 16
0
    li.item_append("newline 1")
    item.delete()
    li.item_append("newline 2")


def bt_clicked_ko(li, item):
    item.delete()
    li.item_append("newline 3")


if __name__ == "__main__":

    def destroy(obj):
        elementary.exit()

    elementary.init()
    win = elementary.Window("test", elementary.ELM_WIN_BASIC)
    win.title_set("List")
    win.callback_destroy_add(destroy)

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.show()

    box0 = elementary.Box(win)
    win.resize_object_add(box0)
    box0.show()

    items = [("test1", bt_clicked_ok), ("test2", bt_clicked_ko)]

    li = elementary.List(win)
Ejemplo n.º 17
0
 def __init__(self, amsn_core):
     elementary.init()