[tuxdroid-svn] r314 - in software: . tuxgi/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-05-11 21:04:37
|
Author: jaguarondi Date: 2007-05-11 23:04:09 +0200 (Fri, 11 May 2007) New Revision: 314 Added: software/tuxgi/ software/tuxgi/trunk/tuxgi.py software/tuxgi/trunk/tuxgi2.glade Removed: software/gtdi/ software/tuxgi/trunk/gtdi.py software/tuxgi/trunk/gtdi2.glade Log: Renamed gtdi into tuxgi Copied: software/tuxgi (from rev 313, software/gtdi) Deleted: software/tuxgi/trunk/gtdi.py =================================================================== --- software/gtdi/trunk/gtdi.py 2007-05-11 14:58:11 UTC (rev 313) +++ software/tuxgi/trunk/gtdi.py 2007-05-11 21:04:09 UTC (rev 314) @@ -1,738 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# ----------------------------------------------------------------------------- -# Tux Droid - Graphique Interface -# Copyright (C) 2007 C2ME Sa <rem...@c2...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# ----------------------------------------------------------------------------- -# $Id: $ -# ----------------------------------------------------------------------------- - -# ----------------------------------------------- -# Initalization of modules -# uses objects "tux" and "tss" -# ----------------------------------------------- -import sys -sys.path.append('/opt/tuxdroid/api/python') -from tux import * -# ----------------------------------------------- -# Your script -# ----------------------------------------------- -import os -from version import app_version -import gtk -import gobject -import thread - -from SimpleGladeApp import SimpleGladeApp -from SimpleGladeApp import bindtextdomain - -app_name = "gtdi2" -print "Graphical TuxDroid Interface " + app_version -glade_dir = "" -locale_dir = "" -soundcard = tux.hw.alsa_device - -bindtextdomain(app_name, locale_dir) - -scommand_window=None -onpause=False -onplay=False -status_list_st=[] -status_list_changed=False -toggled_by_event=False - -for term in ["gnome-terminal", "konsole", "Terminal", "xterm"]: - if not os.popen('type %s'%term).close(): - terminal_app=term - break -#============================================================================== -# Main window class -#============================================================================== -class Window1(SimpleGladeApp): - - #-------------------------------------------------------------------------- - # Class init - #-------------------------------------------------------------------------- - def __init__(self, path="gtdi2.glade", - root="window1", - domain=app_name, **kwargs): - path = os.path.join(glade_dir, path) - SimpleGladeApp.__init__(self, path, root, domain, **kwargs) - - #-------------------------------------------------------------------------- - # On new window - #-------------------------------------------------------------------------- - def new(self): - self.get_widget("comboboxentry1").set_active(2) - tux.tts.on_sound_on=self.on_sound_on - tux.tts.on_sound_off=self.on_sound_off - tux.event.on_status=self.on_status - tux.event.on_left_blue_led_on=self.on_right_blue_led_on - tux.event.on_left_blue_led_off=self.on_right_blue_led_off - tux.event.on_right_blue_led_on=self.on_left_blue_led_on - tux.event.on_right_blue_led_off=self.on_left_blue_led_off - tux.event.on_mouth_stop=self.on_mouth_stop - tux.event.on_eyes_stop=self.on_eyes_stop - thread.start_new_thread(self.status_viewer_thread,()) - tux.daemon.auto_connect(True) - tux.tts.auto_connect(True) - - #-------------------------------------------------------------------------- - # On window destroy - #-------------------------------------------------------------------------- - def on_window1_destroy(self, widget, *args): - global toggled_by_event - toggled_by_event=True - tux.destroy() - sys.exit(0) - - #-------------------------------------------------------------------------- - # On left blue led status is on - #-------------------------------------------------------------------------- - def on_left_blue_led_on(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton1").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On left blue led status is off - #-------------------------------------------------------------------------- - def on_left_blue_led_off(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton1").set_active(False) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On right blue led status is on - #-------------------------------------------------------------------------- - def on_right_blue_led_on(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton2").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On right blue led status is off - #-------------------------------------------------------------------------- - def on_right_blue_led_off(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton2").set_active(False) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On mouth stop - #-------------------------------------------------------------------------- - def on_mouth_stop(self): - global toggled_by_event - toggled_by_event=True - if tux.status.get_mouth_open_position()==0: - self.get_widget("radiobutton3").set_active(True) - else: - self.get_widget("radiobutton4").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On eyes stop - #-------------------------------------------------------------------------- - def on_eyes_stop(self): - global toggled_by_event - toggled_by_event=True - if tux.status.get_eyes_closed_position_switch()==1: - self.get_widget("radiobutton1").set_active(True) - else: - self.get_widget("radiobutton2").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # Event on status - #-------------------------------------------------------------------------- - def on_status(self): - global status_list_st - global status_list_changed - explicite_status=tux.explicit_status() - if explicite_status.find("RF connected->") != 0: - status_list_changed=True - status_list_st.append(explicite_status) - if len(status_list_st)==50: - for i in range(1): - status_list_st.pop(0) - - #-------------------------------------------------------------------------- - # Status viewer refreshing thread - #-------------------------------------------------------------------------- - def status_viewer_thread(self): - global status_list_st - global status_list_changed - global onpause - global onplay - last_tuxdaemon_connect=False - last_tuxttsdaemon_connect=False - last_rf_state=False - while True: - if status_list_changed: - status_list_changed=False - statusview_b=self.get_widget("textview1").get_buffer() - statusview_b.set_text("") - startiter = statusview_b.get_start_iter() - string="" - if self.get_widget("checkbutton3").get_active(): - for i in range(len(status_list_st)): - string=status_list_st[i]+"\n"+string - else: - string=status_list_st[len(status_list_st)-1]+"\n" - statusview_b.insert(startiter,string) - if tux.daemon.connected!=last_tuxdaemon_connect: - last_tuxdaemon_connect=tux.daemon.connected - if tux.daemon.connected: - onpause=False - onplay=False - global toggled_by_event - toggled_by_event=True - global soundcard - tux.hw.alsa_devices_select(0) - soundcard = tux.hw.alsa_device - self.get_widget("togglebutton3").set_active(False) - toggled_by_event=False - self.get_widget("image2").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - self.on_mouth_stop() - self.on_eyes_stop() - tux.cmd.leds_blink(2,1) - else: - self.get_widget("image2").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - tux.status.rf_connected = False - if tux.tts.connected!=last_tuxttsdaemon_connect: - last_tuxttsdaemon_connect=tux.tts.connected - if tux.tts.connected: - self.get_widget("image3").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - else: - self.get_widget("image3").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - if tux.status.rf_state()!=last_rf_state: - last_rf_state = tux.status.rf_connected - if last_rf_state: - self.get_widget("image4").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - else: - self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - tux.sys.wait(0.5) -# ----------------------------------------------------------------------------- -# Tab "main" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On left led checkbox toggled - #-------------------------------------------------------------------------- - def on_ledl_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.ledl_on() - else: - tux.cmd.ledl_off() - - #-------------------------------------------------------------------------- - # On right led checkbox toggled - #-------------------------------------------------------------------------- - def on_ledr_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.ledr_on() - else: - tux.cmd.ledr_off() - - #-------------------------------------------------------------------------- - # On flash leds button clicked - #-------------------------------------------------------------------------- - def on_flash_bt_clicked(self, widget, *args): - def _funct(): - num_sb=self.get_widget("spinbutton1") - tux.cmd.leds_blink(int(num_sb.get_value()),15) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On eyes open radiobutton toggled - #-------------------------------------------------------------------------- - def on_eyes_open_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.eyes_open() - - #-------------------------------------------------------------------------- - # On eyes close radiobutton toggled - #-------------------------------------------------------------------------- - def on_eyes_close_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.eyes_close() - - #-------------------------------------------------------------------------- - # On eyes blink button clicked - #-------------------------------------------------------------------------- - def on_eyes_blink_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton2") - tux.cmd.eyes_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On beak open radiobutton toggled - #-------------------------------------------------------------------------- - def on_beak_open_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.mouth_open() - - #-------------------------------------------------------------------------- - # On beak close radiobutton toggled - #-------------------------------------------------------------------------- - def on_rbeak_close_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.mouth_close() - - #-------------------------------------------------------------------------- - # On beak talk button clicked - #-------------------------------------------------------------------------- - def on_beak_talk_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton3") - tux.cmd.mouth_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On flippers up radiobutton toggled - #-------------------------------------------------------------------------- - def on_flippers_up_toggled(self, widget, *args): - def _funct(): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.raw(0x31,0,0,0) - tux.event.wait_status(DATAS_STATUS_WINGS_POSITION_COUNTER,0,5) - tux.cmd.wings_on(1) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On flippers down radiobutton toggled - #-------------------------------------------------------------------------- - def on_flippers_down_toggled(self, widget, *args): - def _funct(): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.raw(0x31,0,0,0) - tux.event.wait_status(DATAS_STATUS_WINGS_POSITION_COUNTER,0,5) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On flippers flap button clicked - #-------------------------------------------------------------------------- - def on_flippers_flap_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton4") - tux.cmd.wings_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On rotation button clicked - #-------------------------------------------------------------------------- - def on_rotation_spin_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton5") - if self.get_widget("radiobutton7").get_active(): - tux.cmd.spinl_on_free(int(num_sb.get_value())) - else: - tux.cmd.spinr_on_free(int(num_sb.get_value())) - - - #-------------------------------------------------------------------------- - # On "Send command" button clicked - #-------------------------------------------------------------------------- - def on_scommand_bt_clicked(self, widget, *args): - Window2().run() - - #-------------------------------------------------------------------------- - # On "Tux Droid shell" button clicked - #-------------------------------------------------------------------------- - def on_tdshell_bt_clicked(self, widget, *args): - tux.sys.shell_free(terminal_app + ' -e "tuxsh"') - - #-------------------------------------------------------------------------- - # On "Get light level" button clicked - #-------------------------------------------------------------------------- - def on_cversion_bt_clicked(self, widget, *args): - thread.start_new_thread(tux.status.get_light_level,()) - - #-------------------------------------------------------------------------- - # On "Ping" button clicked - #-------------------------------------------------------------------------- - def on_ping_bt_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.ping,(200,)) - -# ----------------------------------------------------------------------------- -# Tab "TTS" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On "default" button clicked - #-------------------------------------------------------------------------- - def on_tts_default_bt_clicked(self, widget, *args): - self.get_widget("comboboxentry1").set_active(2) - self.get_widget("spinbutton6").set_value(100) - - #-------------------------------------------------------------------------- - # On "play" button clicked - #-------------------------------------------------------------------------- - def on_tts_play_bt_clicked(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - global onplay - if onplay: - tux.tts.stop() - else: - voice_cb=self.get_widget("comboboxentry1") - pitch_sb=self.get_widget("spinbutton6") - tux.tts.select_voice(voice_cb.get_active()+1,pitch_sb.get_value()) - tux.tts.stop() - textedit=self.get_widget("textview2") - buffer=textedit.get_buffer() - my_text=buffer.get_text(*buffer.get_bounds()) - tux.tts.speak_free(my_text) - - #-------------------------------------------------------------------------- - # On "pause" button clicked - #-------------------------------------------------------------------------- - def on_tts_pause_bt_clicked(self, widget, *args): - global onpause - if onpause: - tux.tts.play() - onpause=False - else: - tux.tts.pause() - onpause=True - - #-------------------------------------------------------------------------- - # On "Clear text" button clicked - #-------------------------------------------------------------------------- - def on_tts_ctext_bt_clicked(self, widget, *args): - textedit=self.get_widget("textview2") - buffer=textedit.get_buffer() - buffer.set_text("") - - #-------------------------------------------------------------------------- - # On TTS sound on event - #-------------------------------------------------------------------------- - def on_sound_on(self): - global onplay - global toggled_by_event - toggled_by_event=True - self.get_widget("togglebutton3").set_active(True) - toggled_by_event=False - onplay=True - tux.cmd.mouth_open() - - #-------------------------------------------------------------------------- - # On TTS sound off event - #-------------------------------------------------------------------------- - def on_sound_off(self): - global onplay - global toggled_by_event - toggled_by_event=True - self.get_widget("togglebutton3").set_active(False) - toggled_by_event=False - onplay=False - tux.cmd.mouth_close() - -# ----------------------------------------------------------------------------- -# Tab "Audio" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On select external wave file event - #-------------------------------------------------------------------------- - def on_wave_external_changed(self, widget, *args): - filename=widget.get_filename() - ext=len(filename)-filename.find(".wav") - if ext != 4 : - widget.unselect_filename(filename) - - #-------------------------------------------------------------------------- - # On "play" external wave file button clicked - #-------------------------------------------------------------------------- - def on_wave_external_play_bt_clicked(self, widget, *args): - if str(self.get_widget("filechooserbutton1").get_filename())=="None": return - tux.sys.shell_free("aplay -D %s %s"% (soundcard,\ - self.get_widget("filechooserbutton1").get_filename())) - - #-------------------------------------------------------------------------- - # On select original sounds - #-------------------------------------------------------------------------- - def on_incl_orig_toggled(self, widget, *args): - st_wav_paths = wavs.wav_paths - if widget.get_active(): - wavs.wav_paths=[] - wavs.wav_sizes=[] - for i in range(9): - wavs.add_wav_path('/opt/tuxdroid/apps/gtdi/sounds/%d.wav'%(i+1)) - for path in st_wav_paths: - wavs.add_wav_path(path) - else: - if len(st_wav_paths) > 9: - for i in range(9): - wavs.wav_sizes.pop(0) - wavs.wav_paths.pop(0) - else: - wavs.wav_paths=[] - wavs.wav_sizes=[] - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On select internal wave file event - #-------------------------------------------------------------------------- - def on_wave_internal_changed(self, widget, *args): - filename=widget.get_filename() - ext=len(filename)-filename.find(".wav") - if ext != 4 : - widget.unselect_filename(filename) - - #-------------------------------------------------------------------------- - # On "add" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_add_bt_clicked(self, widget, *args): - if str(self.get_widget("filechooserbutton2").get_filename())=="None": return - wavs.add_wav_path(self.get_widget("filechooserbutton2").get_filename()) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On "remove" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_remove_bt_clicked(self, widget, *args): - index=int(self.get_widget("spinbutton8").get_value()) - if index>len(wavs.wav_paths):return - wavs.wav_sizes.pop(index-1) - wavs.wav_paths.pop(index-1) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # Refreshing wave list function - #-------------------------------------------------------------------------- - def refresh_wav_list(self): - wav_te=self.get_widget("textview3") - wav_buffer=wav_te.get_buffer() - wav_buffer.set_text("") - i=1 - for wavfile in wavs.wav_paths: - filename=wavfile[wavfile.rfind('/')+1:] - wav_buffer.insert(wav_buffer.get_end_iter(),"%.2d : %s\n" %(i,filename)) - i=i+1 - - #-------------------------------------------------------------------------- - # On "clear" internal wave file list button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_clist_bt_clicked(self, widget, *args): - wavs.wav_sizes=[] - wavs.wav_paths=[] - self.get_widget("checkbutton4").set_active(False) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On "store" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_store_bt_clicked(self, widget, *args): - thread.start_new_thread(self.sound_storing,()) - - #-------------------------------------------------------------------------- - # Store sound function - #-------------------------------------------------------------------------- - def sound_storing(self): - if tux.status.rf_state() == 0: return - if len(wavs.wav_sizes)==0: return - wav_te=self.get_widget("textview3") - wav_buffer=wav_te.get_buffer() - if not wavs.wavs_merging("merged.wav"): - print wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Error : file merged is too big\n") - return - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Erase flash\n") - tux.cmd.sound_storing(len(wavs.wav_sizes)) - tux.sys.wait(10) - current_pos=0x0400 - tux.sys.wait(0.1) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Indexes\n") - tux.cmd.sound_store_index(0x00,0x04,0x00) - for size in wavs.wav_sizes: - current_pos=current_pos+size - tux.sys.wait(0.1) - tux.cmd.sound_store_index((current_pos & 0xFF0000)>>16,\ - (current_pos & 0x00FF00)>>8,current_pos & 0x0000FF) - wav_buffer.insert(wav_buffer.get_end_iter(),"Sound storing : Record\n") - tux.sys.shell("aplay -D %s merged.wav"%soundcard) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Storage done.\n") - tux.sys.wait(0.3) - - #-------------------------------------------------------------------------- - # On "play" flash sound button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play_bt_clicked(self, widget, *args): - def _funct(): - index=self.get_widget("spinbutton7").get_value() - tux.cmd.sound_play(int(index),0) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On "play flash sound number 1" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play1_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(1,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 2" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play2_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(2,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 3" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play3_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(3,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 4" button clicked - #-------------------------------------------------------------------------- - def on_wave_internat_play4_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(4,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 5" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play5_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(5,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 6" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play6_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(6,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 7" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play7_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(7,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 8" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play8_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(8,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 9" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play9_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(9,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 10" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play10_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(10,0,)) - - #-------------------------------------------------------------------------- - # On "Play recorded wave file" button clicked - #-------------------------------------------------------------------------- - def on_mic_play_bt_clicked(self, widget, *args): - tux.sys.shell_free("aplay -D %s rec.wav"%soundcard) - - #-------------------------------------------------------------------------- - # On "Record wave file" button clicked - #-------------------------------------------------------------------------- - def on_mic_record_bt_clicked(self, widget, *args): - tux.cmd.mouth_open() - tux.sys.shell("arecord -D %s -d 10 -t wav rec.wav"%soundcard) - tux.cmd.mouth_close() - -#============================================================================== -# Send command window class -#============================================================================== -class Window2(SimpleGladeApp): - - #-------------------------------------------------------------------------- - # Init class - #-------------------------------------------------------------------------- - def __init__(self, path="gtdi2.glade", - root="window2", - domain=app_name, **kwargs): - path = os.path.join(glade_dir, path) - SimpleGladeApp.__init__(self, path, root, domain, **kwargs) - - #-------------------------------------------------------------------------- - # On new window - #-------------------------------------------------------------------------- - def new(self): - print "A new %s has been created" % self.__class__.__name__ - - #-------------------------------------------------------------------------- - # On window destroy - #-------------------------------------------------------------------------- - def on_window2_destroy(self, widget, *args): - print "closed" - - #-------------------------------------------------------------------------- - # On "Send command" button clicked - #-------------------------------------------------------------------------- - def on_sendcommand_bt_clicked(self, widget, *args): - commandst=self.get_widget("entry1").get_text() - commands=commandst.split(" ") - if len(commands)<4: - return - else: - commandp=[0,0,0,0] - for i in range(len(commands)): - if commands[i].find("0x")!=-1: - commandp[i]=int(commands[i][2:],16) - else: - commandp[i]=int(commands[i]) - tux.cmd.raw(int(commandp[0]),int(commandp[1]),int(commandp[2]),\ - int(commandp[3])) - - -#------------------------------------------------------------------------------ -# Main -#------------------------------------------------------------------------------ -def main(): - g_tDI = Window1() - gtk.gdk.threads_init() - g_tDI.run() - -if __name__ == "__main__": - main() Deleted: software/tuxgi/trunk/gtdi2.glade =================================================================== --- software/gtdi/trunk/gtdi2.glade 2007-05-11 14:58:11 UTC (rev 313) +++ software/tuxgi/trunk/gtdi2.glade 2007-05-11 21:04:09 UTC (rev 314) @@ -1,2431 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="window1"> - <property name="width_request">621</property> - <property name="height_request">403</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Tux Droid Interface</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <signal name="destroy" handler="on_window1_destroy"/> - - <child> - <widget class="GtkNotebook" id="notebook1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed1"> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="image2"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkImage" id="image3"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">24</property> - </packing> - </child> - - <child> - <widget class="GtkImage" id="image4"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">48</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label27"> - <property name="width_request">166</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Radio connection</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">48</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label9"> - <property name="width_request">136</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Tux Droid daemon</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="width_request">166</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Text To Speech daemon</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">24</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Tuxdroid status</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame2"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed2"> - <property name="visible">True</property> - - <child> - <widget class="GtkSpinButton" id="spinbutton1"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">20 1 255 1 10 10</property> - </widget> - <packing> - <property name="x">2</property> - <property name="y">29</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="checkbutton1"> - <property name="width_request">46</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Left</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ledl_toggled"/> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="checkbutton2"> - <property name="width_request">56</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Right</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ledr_toggled"/> - </widget> - <packing> - <property name="x">96</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button3"> - <property name="width_request">72</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Flash</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_flash_bt_clicked"/> - </widget> - <packing> - <property name="x">97</property> - <property name="y">30</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>LED's</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_FILL</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame3"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment3"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFixed" id="fixed3"> - <property name="visible">True</property> - - <child> - <widget class="GtkSpinButton" id="spinbutton2"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator1"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">136</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton3"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">152</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator2"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">288</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton4"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">304</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator3"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">440</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label13"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Flippers</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">304</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label12"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Beak</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">152</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11"> - <property name="width_request">136</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Eyes</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label14"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Rotation</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">456</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton5"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 100 1 10 10</property> - </widget> - <packing> - <property name="x">456</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton1"> - <property name="width_request">58</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Open</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_eyes_open_toggled"/> - ... [truncated message content] |