Skip to content

Commit

Permalink
- This is the result of
Browse files Browse the repository at this point in the history
  • Loading branch information
arno committed Feb 27, 2007
1 parent f92351d commit b15caf4
Show file tree
Hide file tree
Showing 124 changed files with 9,572 additions and 3,158 deletions.
20 changes: 6 additions & 14 deletions ABC/Scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,9 @@ def UpdateRunningTorrentCounters(self):
print "UpdateRunningTorrentCounters thread",currentThread().getName()
print "counters NOT MAIN THREAD"
print_stack()

self.CalculateTorrentCounters()

statusfunc = self.utility.frame.abc_sb.SetStatusText
statusfunc((" " + self.utility.lang.get('abbrev_loaded') + " %u " % len(self.utility.torrents["all"])), 1)
statusfunc((" " + self.utility.lang.get('abbrev_running') + " %u " % len(self.utility.torrents["active"])), 2)
statusfunc((" " + self.utility.lang.get('abbrev_downloading') + " %u " % len(self.utility.torrents["downloading"])), 3)
statusfunc((" " + self.utility.lang.get('abbrev_seeding') + " %u " % len(self.utility.torrents["seeding"])), 4)
statusfunc((" " + self.utility.lang.get('abbrev_pause') + " %u " % len(self.utility.torrents["pause"])), 5)

try:
if hasattr(self.utility, "bottomline2"):
self.utility.bottomline2.updateCounters()
Expand Down Expand Up @@ -180,11 +173,10 @@ def onUpdateTrayAndStatusBar(self):
# update in status bar
##########################################
if self.utility.frame.abc_sb is not None:
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('abbrev_connections') + " " + str(int(self.totals['connections'])), 6)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('abbrev_down') + " " + downloadspeed, 7)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('abbrev_up') + " " + uploadspeed, 8)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('discover_peer') + " " + npeer, 9)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('discover_file') + " " + nfile, 10)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('abbrev_down') + " " + downloadspeed, 1)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('abbrev_up') + " " + uploadspeed, 2)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('discover_peer') + " " + npeer, 3)
self.utility.frame.abc_sb.SetStatusText(" " + self.utility.lang.get('discover_file') + " " + nfile, 4)

except wx.PyDeadObjectError:
pass
Expand Down Expand Up @@ -486,4 +478,4 @@ def updateListIndex(self, startindex = 0, endindex = None):

def addTorrentFromFileCallback(self,data):
self.invokeLater(self.addtorrents.AddTorrentFromFile,[data])


87 changes: 81 additions & 6 deletions ABC/Toolbars/toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

from Utility.constants import * #IGNORE:W0611

from Tribler.Dialogs.activities import *

DEBUG = True

##############################################################
#
Expand Down Expand Up @@ -80,14 +83,86 @@ def __init__(self, windowparent):
#
##############################################################
class ABCStatusBar(wx.StatusBar):
def __init__(self, parent):
def __init__(self, parent, utility):
self.utility = utility
style = wx.ST_SIZEGRIP | wx.CLIP_CHILDREN

wx.StatusBar.__init__(self, parent, -1, style = style)
self.SetFieldsCount(11)
#self.SetStatusWidths([-1, 45, 35, 35, 35])
self.SetStatusWidths([-1, 45, 35, 35, 35, 35, 50, 120, 120, 100, 100])

self.SetFieldsCount(5)
self.SetStatusWidths([-1, 120, 120, 100, 100])

def setActivity(self,type,msg=u''):

if type == ACT_NONE:
prefix = u''
msg = u''
elif type == ACT_UPNP:
prefix = self.utility.lang.get('act_upnp')
elif type == ACT_REACHABLE:
prefix = self.utility.lang.get('act_reachable')
elif type == ACT_GET_EXT_IP_FROM_PEERS:
prefix = self.utility.lang.get('act_get_ext_ip_from_peers')
elif type == ACT_MEET:
prefix = self.utility.lang.get('act_meet')
elif type == ACT_GOT_METADATA:
prefix = self.utility.lang.get('act_got_metadata')
elif type == ACT_RECOMMEND:
prefix = self.utility.lang.get('act_recommend')

if msg == u'':
text = prefix
else:
text = unicode( prefix+u' '+msg)

if DEBUG:
print "act: Setting activity",text
self.SetStatusText( text, 0)

##############################################################
#
# Class : ABCStatusButtons
#
# The statusbar buttons at the bottom left of the screen
#
##############################################################
class ABCStatusButtons(wx.BoxSizer):
def __init__(self, parent, utility):
self.utility = utility
wx.BoxSizer.__init__(self, wx.HORIZONTAL)

self.reach = False
self.gbm = self.utility.makeBitmap('greenball.bmp')
self.reachbutton = self.utility.makeBitmapButtonFit(parent, 'yellowball.bmp', 'unknownreach_tooltip',self.onClick)
self.Add(self.reachbutton, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3)
self.ybm = self.reachbutton.GetBitmapLabel()
#self.reachbutton.SetBitmapDisabled(self.ybm)
#self.reachbutton.SetBitmapFocus(self.ybm)
#self.reachbutton.SetBitmapSelected(self.ybm)

def setReachable(self,reach):
if self.reachbutton is not None:
if reach:
self.reachbutton.SetBitmapLabel(self.gbm)
self.reachbutton.GetToolTip().SetTip(self.utility.lang.get('reachable_tooltip'))
else:
self.reachbutton.SetBitmapLabel(self.ybm)
self.reachbutton.GetToolTip().SetTip(self.utility.lang.get('unknownreac_tooltip'))
self.reach = reach

def onClick(self,event=None):
if self.reach:
title = self.utility.lang.get('tribler_information')
type = wx.ICON_INFORMATION
msg = self.utility.lang.get('reachable_tooltip')
else:
title = self.utility.lang.get('tribler_warning')
type = wx.ICON_WARNING
msg = self.utility.lang.get('tribler_unreachable_explanation')

dlg = wx.MessageDialog(None, msg, title, wx.OK|type)
result = dlg.ShowModal()
dlg.Destroy()


##############################################################
#
Expand Down Expand Up @@ -133,4 +208,4 @@ def updateMenu(self):
for item in items:
self.utility.actions[item].addToMenu(self, bindto = self.parent)



Loading

0 comments on commit b15caf4

Please sign in to comment.