Changeset 328
- Timestamp:
- 10/21/06 20:29:28 (22 months ago)
- Location:
- murmur/trunk/sources
- Files:
-
- 14 added
- 4 removed
- 5 modified
-
CHANGELOG (modified) (1 diff)
-
COPYING (added)
-
MAINTAINERS (added)
-
README (modified) (1 diff)
-
clean_python (added)
-
encode_bitmaps.py (added)
-
images/away.png (added)
-
images/close.png (added)
-
images/icon.png (added)
-
images/logo.png (modified) (previous)
-
images/noexist.png (added)
-
images/offline.png (added)
-
images/online.png (added)
-
murmur (modified) (44 diffs)
-
pymurmur/imagedata.py (added)
-
pymurmur/trayicon.so (deleted)
-
pymurmur/utils.py (modified) (2 diffs)
-
setup.cfg (added)
-
setup.py (added)
-
trayicon-install (added)
-
trayicon/Makefile (deleted)
-
trayicon/trayicon.c (deleted)
-
trayicon/trayicon.so (deleted)
Legend:
- Unmodified
- Added
- Removed
-
murmur/trunk/sources/CHANGELOG
r280 r328 1 Updated 21 October 2006 2 Version: 0.2.5 3 * UI Changes 4 * Lots of more code refactoring. Moved a lot of functions into classes. 5 * Improved Trayicon's menu 6 * Images are now included in imagedata.py 7 * Added a Window icon 8 * Distutils setup.py added; Murmur can now be installed 9 1 10 Version: 0.2.0 2 11 * Sorted out the threading issues, doesn't lock up with Xlib errors, anymore -
murmur/trunk/sources/README
r280 r328 1 To build trayicon 2 run: 3 ./autogen.py 4 make 1 Murmur is a PyGTK2 Client for Museek / Museek-Plus 2 3 -< DEPENDENCIES >-------------------------------------------------------------- 4 5 Murmur requires: 6 GTK2 >= 2.4 7 PyGTK2 >= 2.4 8 Python >= 2.4 9 mucipher (encryption Python module that comes with Museek) 10 messages.py and driver.py from museek+ 11 12 -< INSTALLATION >-------------------------------------------------------------- 13 14 To run from source: 15 # ./murmur 5 16 6 And/or run: 7 ./murmur 17 To install, run as root: 18 19 # python setup.py install 20 21 -< TRAYICON >------------------------------------------------------------------ 22 23 To build trayicon, you must have: 24 * Python's development headers 25 * gcc (or another suitable compiler) 26 * pkg-config 27 * GTK2's development headers 28 29 To compile: 30 # cd trayicon/ 31 # ./autogen.py 32 # make 33 # make install 34 Or, run: 35 # ./trayicon-install -
murmur/trunk/sources/murmur
r280 r328 1 1 #! /usr/bin/python 2 2 #-*- coding: utf-8 -*- 3 # Murmur - a PyGTK2 client for museek 4 # Code fragments taken from mucous, musetup-gtk, and nicotine 5 # 6 # daelstorm (C) 2005-2006 7 # 8 # This program is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # This program is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 3 22 import pygtk 4 23 pygtk.require("2.0") 5 24 import gtk, gobject 25 import sys, os 6 26 import threading 7 27 from threading import Thread 8 import select, pwd 28 29 try: 30 import mucipher 31 except: 32 print "WARNING: The Mucipher Module for Python wasn't found. This is absolutely necessary to allow Murmur to connect to the Museek Daemon.\nDownload it here: http://thegraveyard.org/files/pymucipher-0.0.1.tar.gz\nExtract the tarball, and as Root or sudo, run:\npython setup.py install\nYou'll need GCC, Python and SWIG." 33 sys.exit() 34 try: 35 import messages, driver 36 except: 37 try: 38 from museek import messages, driver 39 except: 40 print "WARNING: The Museek Message-Parsing modules, messages.py and/or driver.py were not found. Please install them into your '/usr/lib/python2.X/site-packages/museek' directory, or place them in a 'museek' subdirectory of the directory that contains the murmur python scipt." 41 sys.exit() 9 42 10 43 trayicon_load = 1 … … 14 47 print "Optional TrayIcon module not found. Please build it if you want the TrayIcon to work." 15 48 trayicon_load = 0 16 import Queue 17 18 from museek import messages, driver 49 try: 50 from pymurmur import imagedata 51 from pymurmur.settings import Settings 52 from pymurmur.utils import * 53 from pymurmur.utils import _ 54 55 except ImportError: 56 print "Failed loading pymurmur modules. Murmur cannot load." 57 19 58 from time import sleep 20 59 21 import select, string, re, ConfigParser, sys, os, getopt, shutil, commands60 import select, string, re, ConfigParser, getopt, shutil, commands, pwd 22 61 import threading, time 23 62 import signal 24 63 import tempfile 25 64 import imghdr 26 from pymurmur.settings import Settings 27 from pymurmur.utils import * 28 from pymurmur.utils import _ 29 65 66 30 67 pid = os.getpid() 31 68 … … 40 77 log_dir = str(os.path.expanduser("~/.murmur/logs/")) 41 78 config_file = config_dir+"config" 42 version = "0.2.0" 79 43 80 debugmode = False 44 81 … … 171 208 172 209 self.combo = gtk.combo_box_entry_new_text() 173 #if "buddies" in Mapp.ProcessMessages.config.keys(): 174 alist = List #Mapp.ProcessMessages.config["buddies"].keys()210 211 alist = List 175 212 alist.sort() 176 213 for i in alist: … … 226 263 label.show() 227 264 if picture is not None and picture != "": 228 pixbufanim2 = gtk.gdk.PixbufAnimation("%s"% picture)265 #pixbufanim2 = gtk.gdk.PixbufAnimation("%s"% picture) 229 266 image1 = gtk.Image() 230 image1.set_from_ animation(pixbufanim2)267 image1.set_from_pixbuf(picture) 231 268 image1.show() 232 269 box.pack_start(image1) … … 254 291 self.frame = self.app=xapp 255 292 self.config = {} 256 self.queue = Queue.Queue(1)257 293 self.invalidpass = 0 258 294 self.socket = None … … 262 298 #self.timer.start() 263 299 264 # Ping300 ## Ping 265 301 def cb_ping(self): 266 302 if debugmode == True: print " **** cb_ping" … … 305 341 gtk.threads_leave() 306 342 307 # Delete keys from self.config343 ## Delete keys from self.config 308 344 def cb_config_remove(self, domain, key): 309 345 gtk.threads_enter() … … 323 359 #self.display_config_update(domain) 324 360 325 # Copy config to self.config at connection361 ## Copy config to self.config at connection 326 362 def cb_config_state(self, config): 327 363 gtk.threads_enter() … … 348 384 gtk.threads_leave() 349 385 350 #Add new/replace old keys to self.config 351 386 ## Add new/replace old keys to self.config 352 387 def mod_config(self, changetype, username, value): 353 388 … … 534 569 self.frame.room_lists[str(rooms1)] = numbers 535 570 self.frame.chatrooms.roomsmaster.UpdateRoomList(roomlist) 536 537 for room in joined: 571 joined_rooms = joined.keys() 572 joined_rooms.sort(key=str.lower) 573 for room in joined_rooms: 538 574 room = str(room) 539 575 if room not in self.frame.roomlogs: … … 862 898 if debugmode == True: 863 899 print "connect attempt" 864 #Mapp.Qqueue.put("Connecting") 865 #break 900 866 901 else: 867 902 raise Exception, "NOPASS" … … 885 920 self.connected = False 886 921 887 922 ## Process Socket Data 888 923 def run(self): 889 924 if debugmode == True: print self.frame.pid … … 937 972 menuitem = gtk.MenuItem() 938 973 elif item[0] == 1: 939 menuitem = gtk.MenuItem()940 974 menuitem = gtk.MenuItem(item[1]) 941 975 menuitem.set_submenu(item[2]) … … 1253 1287 self.imagedirectory = "images" 1254 1288 self.images = {} 1255 1256 for i in "away", "online", "offline", "noexist": 1257 #loader = gtk.gdk.PixbufLoader("gif") 1258 self.images[i] = gtk.gdk.pixbuf_new_from_file(os.path.join(self.imagedirectory, i)+".gif") 1259 1260 1289 1290 for i in "away", "online", "offline", "noexist", "logo", "close", "green", "yellow", "red", "icon": 1291 loader = gtk.gdk.PixbufLoader("png") 1292 data = getattr(imagedata, i) 1293 loader.write(data, len(data)) 1294 loader.close() 1295 self.images[i] = loader.get_pixbuf() 1296 1297 self.MurmurWindow.set_icon(self.images["icon"]) 1261 1298 self.chatroom_users = {} 1262 1299 self.popup_menu = {} … … 1269 1306 self.roomtab = None 1270 1307 1271 self.close_image = os.path.join(self.imagedirectory, "x.png") 1308 #self.close_image = os.path.join(self.imagedirectory, "x.png") 1309 #self.close_image = self.images["close"] 1272 1310 vbox_murmurwindow = gtk.VBox() 1273 1311 vbox_murmurwindow.set_spacing(2) … … 1424 1462 1425 1463 self.userinfos = UserInfos(self) 1426 1427 self.userinfovbox.pack_start(self.userinfos, True, True, 0)1428 1464 1429 1465 self.hbox21 = gtk.HBox(False, 5) … … 1431 1467 self.hbox21.set_spacing(5) 1432 1468 self.hbox21.set_border_width(5) 1433 1469 1470 self.UserinfoEntry = gtk.Entry() 1471 self.UserinfoEntry.set_text("") 1472 self.UserinfoEntry.set_editable(True) 1473 self.UserinfoEntry.show() 1474 self.UserinfoEntry.set_visibility(True) 1475 self.hbox21.pack_start(self.UserinfoEntry, False, True, 0) 1476 1434 1477 self.sUserinfoButton = gtk.Button() 1435 1478 self.sUserinfoButton.show() … … 1457 1500 self.sUserinfoButton.add(self.alignment12) 1458 1501 1459 self.hbox21.pack_end(self.sUserinfoButton, False, False, 0) 1460 1461 self.UserinfoEntry = gtk.Entry() 1462 self.UserinfoEntry.set_text("") 1463 self.UserinfoEntry.set_editable(True) 1464 self.UserinfoEntry.show() 1465 self.UserinfoEntry.set_visibility(True) 1466 self.hbox21.pack_end(self.UserinfoEntry, False, True, 0) 1467 1468 self.label30 = gtk.Label(_("Input a user:")) 1469 self.label30.set_padding(0, 0) 1470 self.label30.show() 1471 self.hbox21.pack_end(self.label30, False, False, 0) 1502 self.hbox21.pack_start(self.sUserinfoButton, False, False, 0) 1503 1504 1505 #self.label30 = gtk.Label(_("Input a user:")) 1506 #self.label30.set_padding(0, 0) 1507 #self.label30.show() 1508 #self.hbox21.pack_end(self.label30, False, False, 0) 1472 1509 1473 1510 self.userinfovbox.pack_start(self.hbox21, False, True, 0) … … 1475 1512 self.sUserinfoButton.connect("clicked", self.OnGetUserInfo) 1476 1513 self.UserinfoEntry.connect("activate", self.OnGetUserInfo) 1477 1514 self.userinfovbox.pack_start(self.userinfos, True, True, 0) 1478 1515 # User Browse Construction 1479 1516 self.userbrowsevbox = gtk.VBox(False, 0) … … 1647 1684 file1.show() 1648 1685 1649 connect_item = gtk. MenuItem("_Connect")1686 connect_item = gtk.ImageMenuItem("_Connect") 1650 1687 connect_item.connect_object("activate", self.connect_process, None) 1651 1688 connect_item.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("C"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1689 connect_item.set_image(gtk.image_new_from_stock(gtk.STOCK_CONNECT, gtk.ICON_SIZE_MENU)) 1652 1690 connect_item.show() 1653 1691 1654 disconnect_item = gtk. MenuItem("_Disconnect")1692 disconnect_item = gtk.ImageMenuItem("_Disconnect") 1655 1693 disconnect_item.connect_object("activate", self.disconnect, "disconnect") 1656 1694 disconnect_item.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("D"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1695 disconnect_item.set_image(gtk.image_new_from_stock(gtk.STOCK_DISCONNECT, gtk.ICON_SIZE_MENU)) 1657 1696 disconnect_item.show() 1658 1697 1659 settings_item = gtk. MenuItem("_Settings")1660 settings_item.connect_object("activate", self. popup, "settings")1698 settings_item = gtk.ImageMenuItem("_Settings") 1699 settings_item.connect_object("activate", self.SettingsWindow, "settings") 1661 1700 settings_item.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("S"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1701 settings_item.set_image(gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU)) 1662 1702 settings_item.show() 1663 1703 … … 1688 1728 leave1.show() 1689 1729 1690 away_item = gtk. MenuItem("Toggle _Away")1730 away_item = gtk.ImageMenuItem("Toggle _Away") 1691 1731 away_item.connect_object("activate", self.away_toggle, "file.away") 1692 1732 away_item.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("A"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1733 img = gtk.Image() 1734 img.set_from_pixbuf(self.images["away"]) 1735 away_item.set_image(img) 1693 1736 away_item.show() 1694 1737 1695 1738 1696 quit1 = gtk.MenuItem("_Quit Murmur Chat") 1739 1740 quit1 = gtk.ImageMenuItem("_Quit Murmur Chat") 1697 1741 quit1.connect("activate", self.window_quit, "") 1698 1742 quit1.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("Q"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1743 quit1.set_image(gtk.image_new_from_stock(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)) 1699 1744 quit1.show() 1700 1745 1701 join1 = gtk. MenuItem("_Join Room")1746 join1 = gtk.ImageMenuItem("_Join Room") 1702 1747 join1.connect("activate", self.join_popup, "") 1703 1748 join1.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("J"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1749 join1.set_image(gtk.image_new_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_MENU)) 1704 1750 join1.show() 1705 1751 … … 1770 1816 menu4 = gtk.Menu() 1771 1817 1772 about1 = gtk. MenuItem(("_About"))1818 about1 = gtk.ImageMenuItem(("_About")) 1773 1819 about1.connect("activate", self.about) 1774 1820 about1.add_accelerator("activate", self.accel_group, gtk.gdk.keyval_from_name("F1"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE) 1821 about1.set_image(gtk.image_new_from_stock(gtk.STOCK_HELP, gtk.ICON_SIZE_MENU)) 1775 1822 about1.show() 1776 1823 … … 2003 2050 def MouseAction(self, widget, event): 2004 2051 if debugmode == True: print "-- Click -- :" 2005 #user = self.tabs["browse"][self.notebook_browsing.get_current_page()] 2052 2006 2053 d = self.DirTreeView.get_path_at_pos(int(event.x), int(event.y)) 2007 2054 if not d: … … 2024 2071 except Exception,e: 2025 2072 if debugmode == True: print "get_shares", Exception,e 2026 2027 def CloseBrowse(self, user):2028 self.widgets["browse"]["notebook"].remove_page( self.widgets["browse"]["notebook"].page_num( self.widgets["browse"][user]["container"] ) )2029 del self.widgets["browse"][user]2030 self.tabs["browse"].remove(user)2031 2073 2032 2074 def SearchShares(self, user): … … 2135 2177 UserName.set_padding(0, 0) 2136 2178 UserName.show() 2137 image = gtk.image_new_from_stock(gtk.STOCK_C ANCEL, gtk.ICON_SIZE_MENU)2179 image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) 2138 2180 image.show() 2139 2181 button1 = gtk.Button() … … 2467 2509 self.popup_menu = popup = PopupMenu(self.frame, "something") 2468 2510 popup.setup( 2469 ("#" + _("Close"), self.OnClose, gtk.STOCK_C ANCEL),2511 ("#" + _("Close"), self.OnClose, gtk.STOCK_CLOSE), 2470 2512 ("", None), 2471 2513 ("#" + _("Show IP address"), popup.OnShowIPaddress, gtk.STOCK_NETWORK), … … 2730 2772 label.show() 2731 2773 self.append_page(tab.Main, label) #, tab.OnClose) 2732 #self.frame.np.queue.put(slskmessages.GetUserStatus(user)) 2774 2733 2775 if direction: 2734 2776 if self.get_current_page() != self.page_num(self.users[user].Main): … … 3044 3086 if self.leaving: 3045 3087 return 3046 #self.frame.np.queue.put(slskmessages.LeaveRoom(self.room))3047 3088 if self.room in self.roomsmaster.joinedrooms: 3048 3089 self.frame.ProcessMessages.Send(messages.LeaveRoom(self.room)) … … 3127 3168 popup.setup( 3128 3169 ("#" + _("_Join Room"), popup.OnJoinRoom, gtk.STOCK_JUMP_TO), 3129 ("#" + _("_Leave Room"), popup.OnLeaveRoom, gtk.STOCK_C ANCEL),3170 ("#" + _("_Leave Room"), popup.OnLeaveRoom, gtk.STOCK_CLOSE), 3130 3171 ) 3131 3172 self.treeview.connect("button_press_event", self.OnPopupMenu) … … 3214 3255 path, column, x, y = d 3215 3256 room = self.roomsmodel.get_value(self.roomsmodel.get_iter(path), 0) 3216 #if not room in self.joinedrooms.keys(): 3217 #self.frame.np.queue.put(slskmessages.JoinRoom(room)) 3257 3218 3258 return True 3219 3259 elif event.button == 3: … … 3271 3311 #list = self.frame.np.config.sections["server"]["autojoin"] 3272 3312 3273 #for room in list: 3274 #self.frame.np.queue.put(slskmessages.JoinRoom(room)) 3313 3275 3314 3276 3315 #self.roomsmodel = RoomsListModel(msg.rooms) … … 3639 3678 self.Main.pack_end(addhbox, False, False, 0) 3640 3679 self.Main.show() 3641 3642 #vseparator = gtk.VSeparator() 3643 #vseparator.show() 3644 3680 3645 3681 # Naming the tab 3646 3682 self.label = gtk.Label(_("Banned") ) … … 4219 4255 if trayicon_load == 0: 4220 4256 return 4257 self.is_mapped = 1 4221 4258 if self.t == None: 4222 4223 self.t = trayicon.TrayIcon("MyFirstTrayIcon") 4259 self.t = trayicon.TrayIcon("Murmur") 4224 4260 self.eventbox = gtk.EventBox() 4225 self. menu()4261 self.TrayMenu() 4226 4262 if debugmode == True: print "Status:", self.status 4227 4263 if self.status: … … 4443 4479 4444 4480 scrolledwindow1.add(treeview) 4481 4482 # Tab 4445 4483 label2 = gtk.Label( ( self.s_query[query] ) ) 4446 4484 label2.set_padding(0, 0) 4447 4485 label2.show() 4448 image = gtk.image_new_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_MENU) 4486 image = gtk.Image() 4487 image.set_from_pixbuf(self.images["close"]) 4449 4488 image.show() 4450 4489 button1 = gtk.Button() … … 4454 4493 hbox1 = gtk.HBox(False, 0) 4455 4494 hbox1.show() 4456 hbox1.set_spacing( 0)4495 hbox1.set_spacing(2) 4457 4496 hbox1.pack_start(label2, False, False, 0) 4458 4497 hbox1.pack_start(button1, False, False, 0) … … 4658 4697 4659 4698 4660 4661 def menu(self): 4662 try: 4699 def OnPopupServer(self, widget): 4700 items = self.tray_popup_menu_server.get_children() 4701 4702 4703 if self.current_image_name == "red": 4704 items[0].set_sensitive(True) 4705 items[1].set_sensitive(False) 4706 else: 4707 items[0].set_sensitive(False) 4708 items[1].set_sensitive(True) 4709 return 4710 def HideUnhideWindow(self, widget): 4711 if self.is_mapped: 4712 self.MurmurWindow.unmap() 4713 self.is_mapped = 0 4714 else: 4715 self.MurmurWindow.map() 4716 self.MurmurWindow.grab_focus() 4717 self.is_mapped = 1 4718 4719 def TrayMenu(self): 4720 try: 4721 self.tray_popup_menu_server= popup0 = PopupMenu(self, "") 4722 popup0.setup( 4723 ("#" + _("_Connect"), self.connect_process, gtk.STOCK_CONNECT), 4724 ("#" + _("_Disconnect"), self.disconnect, gtk.STOCK_DISCONNECT), 4725 ) 4726 &nbs
