1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 16:27:13 +03:00

696 Commits

Author SHA1 Message Date
Sayak Mukhopadhyay
a52472d6e0 Fix for tray icon not stopping on app stop when minimize to tray option is disabled 2021-04-26 19:18:47 +05:30
Sayak Mukhopadhyay
fc83dcf090 Added annotations for systray 2021-04-26 16:05:40 +05:30
Sayak Mukhopadhyay
b377199119 Changed logic to handle minimize too system tray 2021-04-26 15:36:43 +05:30
Sayak Mukhopadhyay
2dddf02f9b Comments to describe the hack 2021-04-26 14:40:11 +05:30
Sayak Mukhopadhyay
fa58d2f0c2 Added windows OS checks 2021-04-26 14:23:08 +05:30
Sayak Mukhopadhyay
6c0437642e Formatting fixes 2021-04-26 14:03:22 +05:30
Sayak Mukhopadhyay
ecf16762d0 Fixed linting issues with EDMarketConnector.py 2021-04-26 13:37:27 +05:30
Sayak Mukhopadhyay
df31aed6c5 Added appearance config option and implementation for minimize to tray on close functionality 2021-04-26 01:22:01 +05:30
A_D
6f86e173cd
indexed sparse list rather than guessing 2021-04-16 17:41:31 +02:00
A_D
98c946fa31
CAPI loadouts changed from dict to list 2021-04-16 17:11:05 +02:00
Athanasius
53f8209820 Move AppWindow.dump_capi_data() to be in companion.Session instead
It's writing CAPI data to a file, so it should be in companion.py.

Also:

* Use companion.CAPIData as type, not a Mapping.
2021-04-15 16:56:03 +01:00
Athanasius
bb90d0fb59 Suits: If user switches to an unknown loadout, say so 2021-04-13 16:56:48 +01:00
Athanasius
c28dd8c55d Suits: Set/update suit text as necessary.
* After any Journal event we might as well set it.
* Attempt to update on a `SwitchSuitLoadout` event, assuming the new
  slot is one we heard about in the last CAPI data.
2021-04-13 16:48:16 +01:00
Athanasius
29c059c275 Suit: Label and text now properly aligned, and toggling
* There was a 'hidden' padx/pady thing going on, not applying because we
  were hidden/not gridded, so apply in toggle/show.
* Make that padx=5 all over use a common constant.
* Set Suit text if most recent CAPI data contains the relevant data.  If
  it's not present then hide the Suit row.
2021-04-13 15:26:41 +01:00
Athanasius
9ca55e7af7 Suit: Implement auto-toggle of Suit line based on CAPI data
* There's a 'visible' argument to force it, default None to ignore.
  That flag is checked first in the function, and then it sets the
  'current' state to the opposite so the following conditional will do
  the right thing.
* Toggling is triggered in AppWindow.getandsend().
2021-04-13 14:15:45 +01:00
Athanasius
3baf92706d Suits: Initially don't show 'Suit' row of UI
* Don't grid to start with, but store the row it would be on.
* `toggle_suit_row()` to toggle it on/off.  NB: Might implement a "force
  to" `visible` argument, but going to test without for now.
2021-04-13 13:59:41 +01:00
Athanasius
0382e4b451 Suits: Add basic UI for suit label and name
Currently this will always be there, next commit(s) will sort out it
being dynamic.
2021-04-13 12:48:13 +01:00
Athanasius
4b456b402b EDMarketConnector: Mutually exclude --force-localserver-for-auth --force-edmc-protocol 2021-04-12 16:35:39 +01:00
Athanasius
ae2bbc8929 Set config flag for --force-edmc-protocol so protocol.py can test it 2021-04-12 16:25:53 +01:00
Athanasius
c466d17553 EDMarketConnector: Add CL arg to force use of edmc:// protocol
This will be useful when running from source, i.e. in debugger, and
wanting to work on the protocol code.
2021-04-12 16:20:12 +01:00
Athanasius
74656f45c9 Ensure ship type/name is only clickable when we have the data for it.
This is keyed off monitor.state['Modules'] because that's what
monitor.py EDLogs.ship() uses.
2021-04-12 08:31:48 +01:00
Athanasius
a9c4c191e9 Don't try to generate a shipyard link if we have no known loadout.
This is currently the case on Odyssey Alpha Phase 1 when logging in
on-foot.  There's no Journal 'Loadout' event, but the CAPI update does
let us know we have a Sidewinder active.  But `monitor.state['Modules']`
is None.
2021-04-12 08:31:48 +01:00
Athanasius
27961c1513 AppWindow.getandsend: Only blank status text when we play the bad sound
AppWindow.getandsend() is set on a timer for all of StartUp, Location
and Docked.  This means it can trigger up to three times for a login
when docked.

Subsequent calls would hit the cooldown timer and blank the status text
blindly, hiding the 'Last Updated at' text.

To be honest I'm not sure it even needs blanking *then*.
2021-04-12 08:31:47 +01:00
Athanasius
88a3f6d73a Remove erroneous on-foot check for 'Where are you?!'
This causes the check to not work as intended on live and is a left-over
from before fixing the code to just use 'err'.
2021-04-12 08:31:47 +01:00
Athanasius
5c99ef1243 Fix CAPI update properly for on-foot/embarking.
* Stop relying on self.status['text'] as indicator, set and use `err`.
2021-04-12 08:31:47 +01:00
Athanasius
72d200f616 Detect when on-foot but no known station.
This will trigger the "Where are you?!" message, which now can happen.

I need to double-check this against live behaviour, and might move this
to a different check, as I think on live it's valid to query in-space.
2021-04-12 08:31:47 +01:00
Athanasius
ad8c63c64c Move util_ships.py ship_map to data.py ship_name_map
Also refactors data.py to edmc_data.py as I'm having weird issues with
PyCharm debugger not starting, and this seems to be to do with module
name clashes.
2021-04-12 08:31:47 +01:00
Athanasius
0b88117844 chdir() to __file__ when not running frozen 2021-04-12 08:31:46 +01:00
Athanasius
103e856446 EDMarketConnector.py: Move chdir as early as possible
We need the config.py read of .gitversion to be from the right place.
2021-04-12 08:31:46 +01:00
Athanasius
c26d1bce93 Comment out un-necessary logger.trace()
In monitor.py it was all that 'Location' event tracing.
2021-04-12 08:30:51 +01:00
Athanasius
3933dea479 Convert monitor.event_queue to a queue.Queue.
* We now use event_queue.empty() to see if it is indeed empty.
* Changed AppWindow.journal_event() to also use .empty() rather than
  `while True`.  Keeping the `'if not entry'` check just in case.
  This prevents it from calling monitor.get_entry() when the prior run
  through the loop has just emptied the queue.  Thus we'll only log when
  it genuinely IS unexpectedly empty.
* During *game* Shutdown we can send the synthetic 'Shutdown' event
  through, and then find and append the actual game 'Shutdown' event
  (i.e. this wasn't a crash, which is what the synthetic event is meant
  to react to).  But AppWindow.journal_event() loop picks up both events
  in one call, so the second <<JournalEvent>> sends it working on an
  empty queue.
  Thus we log in monitor.get_entry() only if the queue is empty *and*
  the game is still running.
* NB: Also adds 'Component' to the OTHER place montitor.state is
  initialised.
2021-04-12 08:30:51 +01:00
Athanasius
672c0d3d49 Don't log when monitor.get_entry() returns None
This is expected due to code using this just to 'tickle' a display
update.
2021-04-12 08:30:51 +01:00
A_D
5010f133a8 Added font override 2021-04-12 08:30:51 +01:00
Athanasius
5edf8d5b59 Change monitor.state['on_foot'] to 'OnFoot' for consistency 2021-04-12 08:30:51 +01:00
Athanasius
4be52fd259 Add comment about how/when system and station text is updated
It took me hours to track this down, due to the use of
parent.children(), so let's try to shorten that next time.
2021-04-12 08:30:51 +01:00
Athanasius
f45f817fa2 EDDB plugin now setting Station name correctly on_foot
* monitor.on_foot is now monitor.state['on_foot'] as plugins need to
  access it.
* EDDB:journal_entry() now stores that in this.on_foot to check later.
* this.on_foot checked in cmdr_data() to actually set station name from
  that data if needs be.  This avoids setting it to STATION_UNDOCKED if
  data['commander']['docked'] is False, when we're on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
a09512f3b3 Mostly refactoring companion.ship_file_name() into util_ships.py
* Also prevent "You're not docked at a station!" for on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
b3cef1e29b Server Lagging check now works again.
Well, it doesn't now raise ServerLagging for a last Journal with a
LoadGame on-foot and in-station.

It does then cause "You're not docked at a station!" to show up.
2021-04-12 08:30:51 +01:00
Athanasius
b44320f47c Split large 'Server Lagging' test into multiple
Also adjusts the 'docked and station name matches' check to account for
being on-foot.
2021-04-12 08:30:51 +01:00
Athanasius
71fb362c52 EDMarketConnector.py: Two missing type annotations
Surprisingly window_title has nice simple types.
2021-04-01 14:45:53 +01:00
Athanasius
2f9789afdd Update all code to use config.appversion() as a function
This *also* caught some instances where appversion_nobuild should
already have been used, so those were both changed and updated to a
function call.
2021-04-01 14:45:52 +01:00
Athanasius
8b3294ecdd typeshed now handles tk 'name' parameter 2021-04-01 14:45:52 +01:00
Athanasius
bc33bf1b19 Attempt to get develop back to code state before rebase on main. 2021-04-01 14:45:51 +01:00
Athanasius
bc7767c5ce Also wrap as dict(data) in dump_capi_data() 2021-04-01 14:45:51 +01:00
A_D
e475ad6659 Ensured that CAPIData objects are JSON Serialisable
While it isnt directly an issue in main (right now), the fix applies
here forward, so we may as well do it here and not deal with a headache
later.
2021-04-01 14:45:51 +01:00
Athanasius
e777727658 Change JournalLock.obtain_lock() return to an Enum.
This way we can tell the difference between:

1. This process obtained the lock.
2. Another process has the lock.
3. We couldn't get the lock due to not being able to open the lock file
   read-write.

Case 3 is currently also returned if the configured journal directory
doesn't exist.  This will be the case on any MacOS system that never had
the game running.  Likely given the OS hasn't been supported for the
game in years now.

# Conflicts:
#	EDMarketConnector.py
2021-04-01 14:45:50 +01:00
Athanasius
ba91aa4733 Two final s/getint/get_int/g instances.
Tested with firing up under debugger, switching to transparent theme,
repeatedly mousing in and out, switching back to Dark theme.
2021-04-01 14:45:50 +01:00
Athanasius
d39c0521da Move JournalLock class into its own file
Closes #891

# Conflicts:
#	journal_lock.py
#	monitor.py
2021-04-01 14:45:49 +01:00
Athanasius
55ee4485d1 Implement retry of locking when journal dir changed.
In case the user does have another EDMC instance running that they need
to kill first.

# Conflicts:
#	monitor.py
2021-04-01 14:45:49 +01:00
Athanasius
0cb0701ca8 Implement releasing of monitor.JournalLock()
* Implement JournalLock.release_lock().
* Renamed other methods to remove journaldir_ prefix.
* Slightly tweak the code flow for obtaining the lock.
* Implement JournalLock.update_lock(), called from AppWindow.postprefs().

# Conflicts:
#	EDMarketConnector.py
2021-04-01 14:45:49 +01:00