瀏覽代碼

Added new icons

tags/v1.0.0
Robert Klep 11 年之前
父節點
當前提交
f35844b073
共有 13 個文件被更改,包括 21 次插入9 次删除
  1. +20
    -5
      ToggleProxy.py
  2. 二進制
      resources/active.png
  3. 二進制
      resources/icon-0-0-0.png
  4. 二進制
      resources/icon-0-0-1.png
  5. 二進制
      resources/icon-0-1-0.png
  6. 二進制
      resources/icon-0-1-1.png
  7. 二進制
      resources/icon-1-0-0.png
  8. 二進制
      resources/icon-1-0-1.png
  9. 二進制
      resources/icon-1-1-0.png
  10. 二進制
      resources/icon-1-1-1.png
  11. 二進制
      resources/inactive.png
  12. 二進制
      resources/menuicon.psd
  13. +1
    -4
      setup.py

+ 20
- 5
ToggleProxy.py 查看文件

@@ -8,17 +8,23 @@ import commands, re
class ToggleProxy(NSObject):

def applicationDidFinishLaunching_(self, notification):
# find image files
self.active_image = NSImage.imageNamed_("active")
self.inactive_image = NSImage.imageNamed_("inactive")
# load icon files
self.icons = {
'0-0-0' : NSImage.imageNamed_("icon-0-0-0"),
'1-0-0' : NSImage.imageNamed_("icon-1-0-0"),
'0-1-0' : NSImage.imageNamed_("icon-0-1-0"),
'0-0-1' : NSImage.imageNamed_("icon-0-0-1"),
'1-1-0' : NSImage.imageNamed_("icon-1-1-0"),
'1-0-1' : NSImage.imageNamed_("icon-1-0-1"),
'1-1-1' : NSImage.imageNamed_("icon-1-1-1")
}

# make status bar item
self.statusitem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength)
self.statusitem.retain()
# self.statusitem.setTarget_(self)
self.statusitem.setHighlightMode_(False)
self.statusitem.setEnabled_(True)
self.statusitem.setImage_(self.inactive_image)
self.statusitem.setImage_(self.icons['0-0-0'])

# insert a menu into the status bar item
self.menu = NSMenu.alloc().init()
@@ -88,6 +94,15 @@ class ToggleProxy(NSObject):
self.httpsMenuItem.setState_( status.get('HTTPSEnable', False) and NSOnState or NSOffState )
self.socksMenuItem.setState_( status.get('SOCKSEnable', False) and NSOnState or NSOffState )

# update icon
self.statusitem.setImage_(
self.icons['%d-%d-%d' % (
status.get('HTTPEnable', False) and 1 or 0,
status.get('HTTPSEnable', False) and 1 or 0,
status.get('SOCKSEnable', False) and 1 or 0
)]
)

def quitApp_(self, sender):
NSApp.terminate_(self)



二進制
resources/active.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 294 B

二進制
resources/icon-0-0-0.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 308 B

二進制
resources/icon-0-0-1.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 315 B

二進制
resources/icon-0-1-0.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 312 B

二進制
resources/icon-0-1-1.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 316 B

二進制
resources/icon-1-0-0.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 314 B

二進制
resources/icon-1-0-1.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 318 B

二進制
resources/icon-1-1-0.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 316 B

二進制
resources/icon-1-1-1.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 320 B

二進制
resources/inactive.png 查看文件

Before After
Width: 17  |  Height: 17  |  Size: 272 B

二進制
resources/menuicon.psd 查看文件


+ 1
- 4
setup.py 查看文件

@@ -4,10 +4,7 @@ import py2app, sys, os, commands

setup(
app = [ 'ToggleProxy.py' ],
data_files = [
'resources/active.png',
'resources/inactive.png'
],
data_files = glob('resources/icon-*.png'),
options = dict(py2app = dict(
plist = dict(
LSBackgroundOnly = True


Loading…
取消
儲存