Skip to content

Commit

Permalink
revamped credit mining GUI
Browse files Browse the repository at this point in the history
Conflicts:
	Tribler/Main/vwxGUI/MainFrame.py
	Tribler/Main/vwxGUI/home.py
	Tribler/Main/vwxGUI/list.py
	Tribler/Main/vwxGUI/list_item.py
  • Loading branch information
ardhipoetra committed Mar 18, 2016
1 parent 01d7d23 commit cc80e26
Show file tree
Hide file tree
Showing 10 changed files with 799 additions and 259 deletions.
48 changes: 24 additions & 24 deletions Tribler/Main/Dialogs/BoostingDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class AddBoostingSource(wx.Dialog):

def __init__(self, parent):
wx.Dialog.__init__(self, parent, -1, 'Add boosting source', size=(475, 475), name="AddBoostingSourceDialog")
wx.Dialog.__init__(self, parent, -1, 'Add boosting source', size=(275, 275), name="AddBoostingSourceDialog")

self.guiutility = GUIUtility.getInstance()
self.channels = []
self.source = ''

text = wx.StaticText(self, -1, 'Please enter a RSS feed URL or select a channel to start boosting swarms:')
self.channel_radio = wx.RadioButton(self, -1, 'Subscribed Channel:', style=wx.RB_GROUP)
self.channel_choice = wx.Choice(self, -1)
self.channel_choice.Bind(wx.EVT_CHOICE, lambda evt: self.channel_radio.SetValue(True))
text = wx.StaticText(self, -1, 'Please enter a RSS feed URL or directory to start boosting swarms:')
# self.channel_radio = wx.RadioButton(self, -1, 'Subscribed Channel:', style=wx.RB_GROUP)
# self.channel_choice = wx.Choice(self, -1)
# self.channel_choice.Bind(wx.EVT_CHOICE, lambda evt: self.channel_radio.SetValue(True))

self.rss_feed_radio = wx.RadioButton(self, -1, 'RSS feed:')
self.rss_feed_edit = wx.TextCtrl(self, -1)
Expand All @@ -37,8 +37,8 @@ def __init__(self, parent):

sourceGrid = wx.FlexGridSizer(2, 2, 0, 0)
sourceGrid.AddGrowableCol(1)
sourceGrid.Add(self.channel_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP, 5)
sourceGrid.Add(self.channel_choice, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
# sourceGrid.Add(self.channel_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP, 5)
# sourceGrid.Add(self.channel_choice, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
sourceGrid.Add(self.rss_feed_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP, 5)
sourceGrid.Add(self.rss_feed_edit, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
sourceGrid.Add(self.rss_dir_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP, 5)
Expand All @@ -55,30 +55,30 @@ def __init__(self, parent):
vSizer.Add(btnSizer, 0, wx.EXPAND | wx.ALL, 5)
self.SetSizer(vSizer)

def do_db():
return self.guiutility.channelsearch_manager.getMySubscriptions()

def do_gui(delayedResult):
_, channels = delayedResult.get()
self.channels = sorted([(channel.name, channel.dispersy_cid) for channel in channels])
self.channel_choice.SetItems([channel[0] for channel in self.channels])

startWorker(do_gui, do_db, retryOnBusy=True, priority=GUI_PRI_DISPERSY)
# def do_db():
# return self.guiutility.channelsearch_manager.getAllChannels()
#
# def do_gui(delayedResult):
# _, channels = delayedResult.get()
# self.channels = sorted([(channel.name, channel.dispersy_cid) for channel in channels])
# self.channel_choice.SetItems([channel[0] for channel in self.channels])
#
# startWorker(do_gui, do_db, retryOnBusy=True, priority=GUI_PRI_DISPERSY)

def OnOK(self, event):
if self.channel_radio.GetValue():
selection = self.channel_choice.GetSelection()
if selection < len(self.channels):
self.source = self.channels[selection][1]
elif self.rss_feed_radio.GetValue():
# if self.channel_radio.GetValue():
# selection = self.channel_choice.GetSelection()
# if selection < len(self.channels):
# self.source = self.channels[selection][1]
# el

if self.rss_feed_radio.GetValue():
self.source = self.rss_feed_edit.GetValue()
else:
self.source = self.rss_dir_edit.GetValue()

from binascii import hexlify

self.guiutility.Notify(
"Successfully add source for credit mining %s" % hexlify(self.source))
"Successfully add source for credit mining %s" % self.source)

self.EndModal(wx.ID_OK)

Expand Down
Loading

0 comments on commit cc80e26

Please sign in to comment.