Legend:
- Unmodified
- Added
- Removed
-
trunk/config.py
r284 r287 27 27 28 28 import os 29 import platform 29 30 import sys 30 31 import ConfigParser … … 48 49 config_instance = ConfigParser.ConfigParser() 49 50 image_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'share/images/') 51 sound_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'share/sounds/') 50 52 system = os.name 53 # We need something more specific 54 platform = platform.system() 55 51 56 #: Minimum screen height to display all panes of Itaka 52 57 min_screen_height = 800 … … 75 80 configuration_values = {} 76 81 77 if os.environ.get('HOME'): 78 save_path = os.path.join(os.environ.get('HOME'), '.itaka') 82 # Second best choice, TMP/TEMP on most systems 83 save_path = os.environ.get('TMP') or os.environ.get('TEMP') 84 85 # Try APPDATA on Windows or $HOME on POSIX 86 if (system == 'nt'): 87 if os.environ.get('APPDATA'): 88 save_path = os.path.join(os.environ.get('APPDATA'), 'itaka') 89 elif os.environ.get('HOME'): 90 save_path = os.path.join(os.environ.get('HOME'), 'itaka') 79 91 else: 80 save_path = os.environ.get('TMP') or os.environ.get('TEMP') 81 92 if os.environ.get('HOME'): 93 save_path = os.path.join(os.environ.get('HOME'), '.itaka') 94 95 print save_path 82 96 #: Default HTML headers and footers for the server. 83 97 # Putting <meta http-equiv="Refresh" content="5; url=/"> is very useful for debugging … … 163 177 self.config_file = os.path.join(os.environ['HOME'], '.itaka/itaka.conf') 164 178 elif (system == 'nt'): 165 if not (os.path.exists(os.path.join(os.environ['APPDATA'], ' itaka/itaka.ini'))):166 self.create(os.path.join(os.environ['APPDATA'], ' itaka/itaka.ini'))179 if not (os.path.exists(os.path.join(os.environ['APPDATA'], 'Itaka/config.ini'))): 180 self.create(os.path.join(os.environ['APPDATA'], 'Itaka/config.ini')) 167 181 else: 168 self.config_file = os.path.join(os.environ['APPDATA'], ' itaka/itaka.ini')182 self.config_file = os.path.join(os.environ['APPDATA'], 'Itaka/config.ini') 169 183 else: 170 184 # Generic path -
trunk/server.py
r280 r287 488 488 n.attach_to_status_icon(self.gui.status_icon) 489 489 n.show() 490 # if self.configuration['server']['notifysound'] 491 if self.itaka_globals.platform == 'Windows': 492 import winsound 493 # ASYNC lets the program continue and does not wait for end of play. 494 winsound.PlaySound(os.path.join(self.itaka_globals.sound_dir, "snap.wav"), winsound.SND_FILENAME|winsound.SND_ASYNC) 495 elif self.itaka_globals.platform == 'Linux': 496 from wave import open as waveOpen 497 from ossaudiodev import open as ossOpen 498 s = waveOpen(os.path.join(self.itaka_globals.sound_dir, "snap.wav"),'rb') 499 (nc,sw,fr,nf,comptype, compname) = s.getparams( ) 500 dsp = ossOpen('/dev/dsp','w') 501 try: 502 from ossaudiodev import AFMT_S16_NE 503 except ImportError: 504 if byteorder == "little": 505 AFMT_S16_NE = ossaudiodev.AFMT_S16_LE 506 else: 507 AFMT_S16_NE = ossaudiodev.AFMT_S16_BE 508 dsp.setparameters(AFMT_S16_NE, nc, fr) 509 data = s.readframes(nf) 510 s.close() 511 dsp.write(data) 512 dsp.close() 513 514 490 515 self.gui.update_gui(self.counter, self.ip, self.time) 491 516 -
trunk/uigtk.py
r285 r287 550 550 551 551 # Create our Hboxes 552 for n in xrange(1, 1 1+1):552 for n in xrange(1, 12+1): 553 553 setattr(self, 'hbox_preferences_%d' % (n), gtk.HBox(False, 0)) 554 554 … … 593 593 594 594 if self.itaka_globals.notify_available: 595 self.label_preferences_notifications = gtk.Label(_(' Notifications'))595 self.label_preferences_notifications = gtk.Label(_('Desktop notifications')) 596 596 self.label_preferences_notifications.set_justify(gtk.JUSTIFY_LEFT) 597 597 self.label_preferences_notifications.set_alignment(0, 0.50) 598 599 self.label_preferences_notifications_sound = gtk.Label(_('Audio notifications')) 600 self.label_preferences_notifications_sound.set_justify(gtk.JUSTIFY_LEFT) 601 self.label_preferences_notifications_sound.set_alignment(0, 0.50) 598 602 599 603 self.label_preferences_timestamp = gtk.Label(_('Show timestamp in log')) … … 659 663 660 664 self.check_preferences_timestamp = gtk.CheckButton() 665 ## if self.configuration['log']['timestamp']: 666 ## self.check_preferences_notifications.set_active(1) 667 ## else: 668 ## self.check_preferences_notifications.set_active(0) 669 670 self.check_preferences_notifications_sound = gtk.CheckButton() 661 671 ## if self.configuration['log']['timestamp']: 662 672 ## self.check_preferences_notifications.set_active(1) … … 703 713 self.hbox_preferences_9.pack_end(self.check_preferences_notifications, False, False, 7) 704 714 705 self.hbox_preferences_10.pack_start(self.label_preferences_timestamp, False, False, 12) 706 self.hbox_preferences_10.pack_end(self.check_preferences_timestamp, False, False, 7) 707 708 self.hbox_preferences_11.pack_start(self.button_preferences_about, False, False, 7) 709 self.hbox_preferences_11.pack_end(self.button_preferences_close, False, False, 7) 715 self.hbox_preferences_10.pack_start(self.label_preferences_notifications_sound, False, False, 12) 716 self.hbox_preferences_10.pack_end(self.check_preferences_notifications_sound, False, False, 7) 717 718 self.hbox_preferences_11.pack_start(self.label_preferences_timestamp, False, False, 12) 719 self.hbox_preferences_11.pack_end(self.check_preferences_timestamp, False, False, 7) 720 721 self.hbox_preferences_12.pack_start(self.button_preferences_about, False, False, 7) 722 self.hbox_preferences_12.pack_end(self.button_preferences_close, False, False, 7) 710 723 711 724 self.vbox_preferences_items.pack_start(self.hbox_preferences_1, False, False, 0) … … 725 738 726 739 self.vbox_preferences_items.pack_start(self.hbox_preferences_10, False, False, 0) 740 self.vbox_preferences_items.pack_start(self.hbox_preferences_11, False, False, 0) 727 741 728 742 self.frame_preference_settings.add(self.vbox_preferences_items) 729 743 self.vbox_preferences.pack_start(self.frame_preference_settings, False, False, 0) 730 self.vbox_preferences.pack_start(self.hbox_preferences_1 1, False, False, 4)744 self.vbox_preferences.pack_start(self.hbox_preferences_12, False, False, 4) 731 745 732 746 self.window.add(self.vbox)
Note: See TracChangeset
for help on using the changeset viewer.

