Browse Source

Added new icons

tags/v1.0.0
Robert Klep 11 years ago
parent
commit
f35844b073
13 changed files with 21 additions and 9 deletions
  1. +20
    -5
      ToggleProxy.py
  2. BIN
      resources/active.png
  3. BIN
      resources/icon-0-0-0.png
  4. BIN
      resources/icon-0-0-1.png
  5. BIN
      resources/icon-0-1-0.png
  6. BIN
      resources/icon-0-1-1.png
  7. BIN
      resources/icon-1-0-0.png
  8. BIN
      resources/icon-1-0-1.png
  9. BIN
      resources/icon-1-1-0.png
  10. BIN
      resources/icon-1-1-1.png
  11. BIN
      resources/inactive.png
  12. BIN
      resources/menuicon.psd
  13. +1
    -4
      setup.py

+ 20
- 5
ToggleProxy.py View File

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


def applicationDidFinishLaunching_(self, notification): 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 # make status bar item
self.statusitem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength) self.statusitem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength)
self.statusitem.retain() self.statusitem.retain()
# self.statusitem.setTarget_(self)
self.statusitem.setHighlightMode_(False) self.statusitem.setHighlightMode_(False)
self.statusitem.setEnabled_(True) 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 # insert a menu into the status bar item
self.menu = NSMenu.alloc().init() self.menu = NSMenu.alloc().init()
@@ -88,6 +94,15 @@ class ToggleProxy(NSObject):
self.httpsMenuItem.setState_( status.get('HTTPSEnable', False) and NSOnState or NSOffState ) self.httpsMenuItem.setState_( status.get('HTTPSEnable', False) and NSOnState or NSOffState )
self.socksMenuItem.setState_( status.get('SOCKSEnable', 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): def quitApp_(self, sender):
NSApp.terminate_(self) NSApp.terminate_(self)




BIN
resources/active.png View File

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

BIN
resources/icon-0-0-0.png View File

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

BIN
resources/icon-0-0-1.png View File

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

BIN
resources/icon-0-1-0.png View File

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

BIN
resources/icon-0-1-1.png View File

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

BIN
resources/icon-1-0-0.png View File

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

BIN
resources/icon-1-0-1.png View File

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

BIN
resources/icon-1-1-0.png View File

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

BIN
resources/icon-1-1-1.png View File

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

BIN
resources/inactive.png View File

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

BIN
resources/menuicon.psd View File


+ 1
- 4
setup.py View File

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


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


Loading…
Cancel
Save