This commit is contained in:
jmdaweb 2014-12-01 13:14:36 +01:00
commit c12902d011
8 changed files with 175 additions and 20 deletions

4
.gitignore vendored
View File

@ -1,12 +1,8 @@
*.pyc
*~
#windows-dependencies/*
src/build/
src/dist/
src/config/
src/config1/
src/config2/
src/config3/
src/dropbox/
src/logs/
src/documentation/

View File

@ -27,6 +27,7 @@ import logging as original_logger
import output
import platform
import datetime
import menus
from twitter import prettydate
from multiplatform_widgets import widgets
from mysc import event
@ -39,6 +40,8 @@ class basePanel(wx.Panel):
def bind_events(self):
self.Bind(event.MyEVT_OBJECT, self.update)
self.Bind(event.MyEVT_DELETED, self.Remove)
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.showMenu, self.list.list)
self.Bind(wx.EVT_LIST_KEY_DOWN, self.showMenuByKey, self.list.list)
self.list.list.Bind(wx.EVT_CHAR_HOOK, self.interact)
if self.system == "Windows":
self.list.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onFocus)
@ -369,3 +372,18 @@ class basePanel(wx.Panel):
self.list.select_item(len(self.db.settings[self.name_buffer])-1)
else:
self.list.select_item(0)
def showMenu(self, ev):
if self.list.get_count() == 0: return
if self.name_buffer == "sent":
self.PopupMenu(menus.sentPanelMenu(self), ev.GetPosition())
else:
self.PopupMenu(menus.basePanelMenu(self), ev.GetPosition())
def showMenuByKey(self, ev):
if self.list.get_count() == 0: return
if ev.GetKeyCode() == wx.WXK_WINDOWS_MENU:
if self.name_buffer == "sent":
self.PopupMenu(menus.sentPanelMenu(self), self.list.list.GetPosition())
else:
self.PopupMenu(menus.basePanelMenu(self), self.list.list.GetPosition())

View File

@ -19,6 +19,7 @@
import wx
import sound
import gui.dialogs
import menus
import logging as original_logger
from base import basePanel
from mysc.thread_utils import call_threaded
@ -47,3 +48,12 @@ class dmPanel(basePanel):
call_threaded(self.twitter.api_call, call_name="send_direct_message", _sound="dm_sent.ogg", text=dlg.text.GetValue(), screen_name=dlg.cb.GetValue())
if ev != None:
self.list.list.SetFocus()
def showMenu(self, ev):
if self.list.get_count() == 0: return
self.PopupMenu(menus.dmPanelMenu(self), ev.GetPosition())
def showMenuByKey(self, ev):
if self.list.get_count() == 0: return
if ev.GetKeyCode() == wx.WXK_WINDOWS_MENU:
self.PopupMenu(menus.dmPanelMenu(self), self.list.list.GetPosition())

View File

@ -21,6 +21,7 @@ import sound
import config
import platform
import gui.dialogs
import menus
import output
import logging as original_logger
from multiplatform_widgets import widgets
@ -36,6 +37,8 @@ class eventsPanel(wx.Panel):
def bind_events(self):
self.Bind(event.MyEVT_OBJECT, self.update)
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.showMenu, self.list.list)
self.Bind(wx.EVT_LIST_KEY_DOWN, self.showMenuByKey, self.list.list)
def put_items(self, items):
pass
@ -132,3 +135,12 @@ class eventsPanel(wx.Panel):
ev.Skip()
except:
pass
def showMenu(self, ev):
if self.list.get_count() == 0: return
self.PopupMenu(menus.eventsPanelMenu(self), ev.GetPosition())
def showMenuByKey(self, ev):
if self.list.get_count() == 0: return
if ev.GetKeyCode() == wx.WXK_WINDOWS_MENU:
self.PopupMenu(menus.eventsPanelMenu(self), self.list.list.GetPosition())

120
src/gui/buffers/menus.py Normal file
View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
import wx
class basePanelMenu(wx.Menu):
def __init__(self, parent):
super(basePanelMenu, self).__init__()
self.window = parent
retweet = wx.MenuItem(self, wx.NewId(), _(u"&Retweet"))
self.Bind(wx.EVT_MENU, self.window.onRetweet, retweet)
self.AppendItem(retweet)
reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
self.Bind(wx.EVT_MENU, self.window.onResponse, reply)
self.AppendItem(reply)
fav = wx.MenuItem(self, wx.NewId(), _(u"Add to &favourites"))
self.Bind(wx.EVT_MENU, self.window.parent.fav, fav)
self.AppendItem(fav)
unfav = wx.MenuItem(self, wx.NewId(), _(u"Remove from favo&urites"))
self.Bind(wx.EVT_MENU, self.window.parent.unfav, unfav)
self.AppendItem(unfav)
openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.Bind(wx.EVT_MENU, self.window.parent.url, openUrl)
self.AppendItem(openUrl)
play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.Bind(wx.EVT_MENU, self.window.parent.audio, play)
self.AppendItem(play)
view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
self.Bind(wx.EVT_MENU, self.window.parent.view, view)
self.AppendItem(view)
copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.Bind(wx.EVT_MENU, self.window.parent.copy_to_clipboard, copy)
self.AppendItem(copy)
remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.Bind(wx.EVT_MENU, self.window.parent.delete, remove)
self.AppendItem(remove)
userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.Bind(wx.EVT_MENU, self.window.parent.onFollow, userActions)
self.AppendItem(userActions)
class dmPanelMenu(wx.Menu):
def __init__(self, parent):
super(dmPanelMenu, self).__init__()
self.window = parent
reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
self.Bind(wx.EVT_MENU, self.window.onResponse, reply)
self.AppendItem(reply)
openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.Bind(wx.EVT_MENU, self.window.parent.url, openUrl)
self.AppendItem(openUrl)
play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.Bind(wx.EVT_MENU, self.window.parent.audio, play)
self.AppendItem(play)
view = wx.MenuItem(self, wx.NewId(), _(u"&Show direct message"))
self.Bind(wx.EVT_MENU, self.window.parent.view, view)
self.AppendItem(view)
copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.Bind(wx.EVT_MENU, self.window.parent.copy_to_clipboard, copy)
self.AppendItem(copy)
remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.Bind(wx.EVT_MENU, self.window.parent.delete, remove)
self.AppendItem(remove)
userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.Bind(wx.EVT_MENU, self.window.parent.onFollow, userActions)
self.AppendItem(userActions)
class sentPanelMenu(wx.Menu):
def __init__(self, parent):
super(sentPanelMenu, self).__init__()
self.window = parent
openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.Bind(wx.EVT_MENU, self.window.parent.url, openUrl)
self.AppendItem(openUrl)
play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.Bind(wx.EVT_MENU, self.window.parent.audio, play)
self.AppendItem(play)
view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
self.Bind(wx.EVT_MENU, self.window.parent.view, view)
self.AppendItem(view)
copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.Bind(wx.EVT_MENU, self.window.parent.copy_to_clipboard, copy)
self.AppendItem(copy)
remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.Bind(wx.EVT_MENU, self.window.parent.delete, remove)
self.AppendItem(remove)
class eventsPanelMenu(wx.Menu):
def __init__(self, parent):
super(eventsPanelMenu, self).__init__()
self.window = parent
view = wx.MenuItem(self, wx.NewId(), _(u"&Show event"))
self.Bind(wx.EVT_MENU, self.window.parent.view, view)
self.AppendItem(view)
copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.Bind(wx.EVT_MENU, self.window.parent.copy_to_clipboard, copy)
self.AppendItem(copy)
remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.Bind(wx.EVT_MENU, self.window.parent.delete, remove)
self.AppendItem(remove)
class peoplePanelMenu(wx.Menu):
def __init__(self, parent):
super(peoplePanelMenu, self).__init__()
self.window = parent
reply = wx.MenuItem(self, wx.NewId(), _(u"&Mention"))
self.Bind(wx.EVT_MENU, self.window.onResponse, reply)
self.AppendItem(reply)
lists = wx.MenuItem(self, wx.NewId(), _(u"&View lists"))
self.Bind(wx.EVT_MENU, self.window.parent.view_user_lists, lists)
self.AppendItem(lists)
details = wx.MenuItem(self, wx.NewId(), _(u"Show user &profile"))
self.Bind(wx.EVT_MENU, self.window.parent.details, details)
self.AppendItem(details)
view = wx.MenuItem(self, wx.NewId(), _(u"&Show user"))
self.Bind(wx.EVT_MENU, self.window.parent.view, view)
self.AppendItem(view)
copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.Bind(wx.EVT_MENU, self.window.parent.copy_to_clipboard, copy)
self.AppendItem(copy)
userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.Bind(wx.EVT_MENU, self.window.parent.onFollow, userActions)
self.AppendItem(userActions)

View File

@ -21,6 +21,7 @@ import sound
import config
import twitter
import gui.dialogs
import menus
import logging as original_logger
import output
from multiplatform_widgets import widgets
@ -36,6 +37,8 @@ class peoplePanel(basePanel):
self.Bind(event.MyEVT_OBJECT, self.update)
self.Bind(event.MyEVT_DELETED, self.Remove)
self.list.list.Bind(wx.EVT_CHAR_HOOK, self.interact)
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.showMenu, self.list.list)
self.Bind(wx.EVT_LIST_KEY_DOWN, self.showMenuByKey, self.list.list)
def create_list(self):
self.list = widgets.list(self, _(u"User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800))
@ -146,3 +149,12 @@ class peoplePanel(basePanel):
else:
list = self.compose_function(self.db.settings[self.name_buffer][self.list.get_selected()], self.db)
return " ".join(list)
def showMenu(self, ev):
if self.list.get_count() == 0: return
self.PopupMenu(menus.peoplePanelMenu(self), ev.GetPosition())
def showMenuByKey(self, ev):
if self.list.get_count() == 0: return
if ev.GetKeyCode() == wx.WXK_WINDOWS_MENU:
self.PopupMenu(menus.peoplePanelMenu(self), self.list.list.GetPosition())

View File

@ -58,7 +58,7 @@ class mainFrame(wx.Frame):
# Application menu
app = wx.Menu()
switch_account = app.Append(wx.NewId(), _(u"S&witch account"))
self.Bind(wx.EVT_MENU, self.switch_account)
self.Bind(wx.EVT_MENU, self.switch_account, switch_account)
updateProfile = app.Append(wx.NewId(), _(u"&Update profile"))
self.Bind(wx.EVT_MENU, self.update_profile, updateProfile)
show_hide = app.Append(wx.NewId(), _(u"&Hide window"))

View File

@ -1,13 +0,0 @@
#!/bin/bash
mkdir ../src/documentation
for i in `ls ../documentation`
do
if test -d ../documentation/$i
then
mkdir ../src/documentation/$i
pandoc -s ../documentation/$i/changes.md -o ../src/documentation/$i/changes.html
pandoc -s ../documentation/$i/manual.md -o ../src/documentation/$i/manual.html
cp ../documentation/license.txt ../src/documentation/license.txt
fi
done
exit