Skip to content

Commit

Permalink
Make System and Station names copyable with right-click.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marginal committed Sep 18, 2015
1 parent 7709ec5 commit e9028ff
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 25 deletions.
11 changes: 11 additions & 0 deletions EDMarketConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ def __init__(self, master=None, **kw):
self.font_n = kw.get('font', ttk.Style().lookup('TLabel', 'font'))
self.font_u = tkFont.Font(self, self.font_n)
self.font_u.configure(underline = True)
self.menu = tk.Menu(None, tearoff=tk.FALSE)
self.menu.add_command(label=_('Copy'), command = self.copy) # As in Copy and Paste
self.bind('<Enter>', self._enter)
self.bind('<Leave>', self._leave)
self.bind('<Button-1>', self._click)
self.bind(platform == 'darwin' and '<Button-2>' or '<Button-3>', self._contextmenu)

# Make blue and clickable if setting non-empty text
def __setitem__(self, key, value):
Expand All @@ -71,6 +74,14 @@ def _click(self, event):
if self.urlfn and self['text']:
webbrowser.open(self.urlfn(self['text']))

def _contextmenu(self, event):
if self['text'] and self['text'] != '-':
self.menu.post(platform == 'darwin' and event.x_root + 1 or event.x_root, event.y_root)

def copy(self):
self.clipboard_clear()
self.clipboard_append(self['text'])


class AppWindow:

Expand Down
53 changes: 28 additions & 25 deletions L10n/en.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Use same text as E:D Launcher's verification dialog. [prefs.py:319] */
"A verification code has now been sent to the{CR}email address associated with your Elite account." = "A verification code has now been sent to the{CR}email address associated with your Elite account.";

/* App menu entry on OSX. [EDMarketConnector.py:138] */
/* App menu entry on OSX. [EDMarketConnector.py:149] */
"About {APP}" = "About {APP}";

/* Folder selection button on Windows. [prefs.py:113] */
Expand All @@ -10,40 +10,43 @@
/* Folder selection button on OSX. [prefs.py:112] */
"Change..." = "Change...";

/* [EDMarketConnector.py:139] */
/* [EDMarketConnector.py:150] */
"Check for Updates..." = "Check for Updates...";

/* Privacy setting. [prefs.py:152] */
"Cmdr name" = "Cmdr name";

/* Main window. [EDMarketConnector.py:112] */
/* Main window. [EDMarketConnector.py:123] */
"Cmdr:" = "Cmdr:";

/* Update button in main window. [EDMarketConnector.py:393] */
/* Update button in main window. [EDMarketConnector.py:406] */
"cooldown {SS}s" = "cooldown {SS}s";

/* As in Copy and Paste. [EDMarketConnector.py:51] */
"Copy" = "Copy";

/* Section heading in settings. [prefs.py:70] */
"Credentials" = "Credentials";

/* [EDMarketConnector.py:354] */
/* [EDMarketConnector.py:367] */
"Error: Can't connect to EDDN" = "Error: Can't connect to EDDN";

/* [EDMarketConnector.py:359] */
/* [EDMarketConnector.py:372] */
"Error: Connection to EDDN timed out" = "Error: Connection to EDDN timed out";

/* [companion.py:108] */
/* [companion.py:110] */
"Error: Invalid Credentials" = "Error: Invalid Credentials";

/* [companion.py:102] */
/* [companion.py:104] */
"Error: Server is down" = "Error: Server is down";

/* Item in the File menu on Windows. [EDMarketConnector.py:156] */
/* Item in the File menu on Windows. [EDMarketConnector.py:167] */
"Exit" = "Exit";

/* [EDMarketConnector.py:245] */
/* [EDMarketConnector.py:259] */
"Fetching station data..." = "Fetching station data...";

/* Menu title on Windows. [EDMarketConnector.py:157] */
/* Menu title on Windows. [EDMarketConnector.py:168] */
"File" = "File";

/* Output folder prompt on Windows. [prefs.py:111] */
Expand All @@ -61,10 +64,10 @@
/* Section heading in settings on OSX. [prefs.py:125] */
"Keyboard shortcut" = "Keyboard shortcut";

/* [EDMarketConnector.py:313] */
/* [EDMarketConnector.py:326] */
"Last updated at {HH}:{MM}:{SS}" = "Last updated at {HH}:{MM}:{SS}";

/* [EDMarketConnector.py:198] */
/* [EDMarketConnector.py:209] */
"Logging in..." = "Logging in...";

/* [prefs.py:102] */
Expand Down Expand Up @@ -121,10 +124,10 @@
/* [prefs.py:96] */
"Send station data to the Elite Dangerous Data Network" = "Send station data to the Elite Dangerous Data Network";

/* [EDMarketConnector.py:333] */
/* [EDMarketConnector.py:346] */
"Sending data to EDDN..." = "Sending data to EDDN...";

/* Item in the File menu on Windows. [EDMarketConnector.py:154] */
/* Item in the File menu on Windows. [EDMarketConnector.py:165] */
"Settings" = "Settings";

/* [prefs.py:106] */
Expand All @@ -133,40 +136,40 @@
/* [prefs.py:104] */
"Ship loadout in E:D Shipyard format" = "Ship loadout in E:D Shipyard format";

/* [EDMarketConnector.py:340] */
/* [EDMarketConnector.py:353] */
"Station doesn't have a market!" = "Station doesn't have a market!";

/* [EDMarketConnector.py:338] */
/* [EDMarketConnector.py:351] */
"Station doesn't have anything!" = "Station doesn't have anything!";

/* Main window. [EDMarketConnector.py:114] */
/* Main window. [EDMarketConnector.py:125] */
"Station:" = "Station:";

/* Main window. [EDMarketConnector.py:113] */
/* Main window. [EDMarketConnector.py:124] */
"System:" = "System:";

/* Update button in main window. [EDMarketConnector.py:119] */
/* Update button in main window. [EDMarketConnector.py:130] */
"Update" = "Update";

/* Use same text as E:D Launcher's login dialog. [prefs.py:75] */
"Username (Email)" = "Username (Email)";

/* Shouldn't happen. [EDMarketConnector.py:270] */
/* Shouldn't happen. [EDMarketConnector.py:283] */
"What are you flying?!" = "What are you flying?!";

/* Shouldn't happen. [EDMarketConnector.py:267] */
/* Shouldn't happen. [EDMarketConnector.py:280] */
"Where are you?!" = "Where are you?!";

/* Output folder prompt on OSX. [prefs.py:110] */
"Where:" = "Where:";

/* Shouldn't happen. [EDMarketConnector.py:264] */
/* Shouldn't happen. [EDMarketConnector.py:277] */
"Who are you?!" = "Who are you?!";

/* Menu title on OSX. [EDMarketConnector.py:142] */
/* Menu title on OSX. [EDMarketConnector.py:153] */
"Window" = "Window";

/* [EDMarketConnector.py:316] */
/* [EDMarketConnector.py:329] */
"You're not docked at a station!" = "You're not docked at a station!";

/* Shortcut settings prompt on OSX. [prefs.py:133] */
Expand Down
3 changes: 3 additions & 0 deletions L10n/fr.strings
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@

/* Hotkey/Shortcut setting. [prefs.py:141] */
"Only when Elite: Dangerous is the active app" = "Seulement quand Elite: Dangerous est l'application active";

/* As in Copy and Paste. [EDMarketConnector.py:51] */
"Copy" = "Copier";
3 changes: 3 additions & 0 deletions L10n/it.strings
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,6 @@

/* Hotkey/Shortcut setting. [prefs.py:141] */
"Only when Elite: Dangerous is the active app" = "Solo quando “Elite: Dangerous” è avviato";

/* As in Copy and Paste. [EDMarketConnector.py:51] */
"Copy" = "Copia";
3 changes: 3 additions & 0 deletions L10n/pl.strings
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@

/* Hotkey/Shortcut setting. [prefs.py:141] */
"Only when Elite: Dangerous is the active app" = "Tylko gdy Elite: Dangerous jest aplikacją aktywną";

/* As in Copy and Paste. [EDMarketConnector.py:51] */
"Copy" = "Kopiuj";

0 comments on commit e9028ff

Please sign in to comment.