Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Command Line Interface mode #173

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Every ~60 seconds, the application sends a "minute watched" event to the channel
- Make sure to link your Twitch account to game accounts on the [campaigns page](https://www.twitch.tv/drops/campaigns), to enable more games to be mined.
- Persistent cookies will be stored in the `cookies.jar` file, from which the authorization (login) information will be restored on each subsequent run.

#### Running on server without GUI:

- Add the argument `--cli` to launch in the Command Line Interface mode.
- To log in, you should open a link shown in the message, and enter the shown code on the webpage.
- Only necessary information is displayed, and all settings are configured in `settings.json`.

### Pictures:

![Main](https://user-images.githubusercontent.com/4180725/164298155-c0880ad7-6423-4419-8d73-f3c053730a1b.png)
Expand Down
278 changes: 278 additions & 0 deletions base_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
from abc import abstractmethod, ABCMeta
DevilXD marked this conversation as resolved.
Show resolved Hide resolved


class BaseStatusBar(metaclass=ABCMeta):
@abstractmethod
def update(self, text):
pass

@abstractmethod
def clear(self):
pass


class BaseWebsocketStatus(metaclass=ABCMeta):
@abstractmethod
def update(self, idx, status, topics):
pass

@abstractmethod
def remove(self, idx):
pass


class BaseLoginForm(metaclass=ABCMeta):
@abstractmethod
def clear(self, login, password, token):
pass

@abstractmethod
def wait_for_login_press(self):
pass

@abstractmethod
def ask_login(self):
pass

@abstractmethod
def update(self, status, user_id):
pass

@abstractmethod
def ask_enter_code(self, user_code):
pass


class BaseTrayIcon(metaclass=ABCMeta):
@abstractmethod
def is_tray(self):
pass

@abstractmethod
def get_title(self, drop):
pass

@abstractmethod
def start(self):
pass

@abstractmethod
def stop(self):
pass

@abstractmethod
def quit(self):
pass

@abstractmethod
def minimize(self):
pass

@abstractmethod
def restore(self):
pass

@abstractmethod
def notify(self, message, title, duration):
pass

@abstractmethod
def update_title(self, drop):
pass


class BaseSettingsPanel(metaclass=ABCMeta):
@abstractmethod
def clear_selection(self):
pass

@abstractmethod
def update_notifications(self):
pass

@abstractmethod
def update_autostart(self):
pass

@abstractmethod
def set_games(self, games):
pass

@abstractmethod
def priorities(self):
pass

@abstractmethod
def priority_add(self):
pass

@abstractmethod
def priority_move(self, up):
pass

@abstractmethod
def priority_delete(self):
pass

@abstractmethod
def priority_only(self):
pass

@abstractmethod
def exclude_add(self):
pass

@abstractmethod
def exclude_delete(self):
pass


class BaseInventoryOverview(metaclass=ABCMeta):
@abstractmethod
def refresh(self):
pass

@abstractmethod
def add_campaign(self, campaign):
pass

@abstractmethod
def clear(self):
pass

@staticmethod
@abstractmethod
def get_status(campaign):
pass

@staticmethod
@abstractmethod
def get_progress(drop):
pass

@abstractmethod
def update_drop(self, drop):
pass


class BaseCampaignProgress(metaclass=ABCMeta):
@abstractmethod
def start_timer(self):
pass

@abstractmethod
def stop_timer(self):
pass

@abstractmethod
def display(self, drop, countdown, subone):
pass


class BaseConsoleOutput(metaclass=ABCMeta):
@abstractmethod
def print(self, message):
pass


class BaseChannelList(metaclass=ABCMeta):
@abstractmethod
def shrink(self):
pass

@abstractmethod
def clear_watching(self):
pass

@abstractmethod
def set_watching(self, channel):
pass

@abstractmethod
def get_selection(self):
pass

@abstractmethod
def clear_selection(self):
pass

@abstractmethod
def clear(self):
pass

@abstractmethod
def display(self, channel, add):
pass

@abstractmethod
def remove(self, channel):
pass


class BaseInterfaceManager(metaclass=ABCMeta):
@abstractmethod
def wnd_proc(self, hwnd, msg, w_param, l_param):
"""
This function serves as a message processor for all messages sent
to the application by Windows.
"""
pass

@abstractmethod
async def wait_until_closed(self):
pass

@abstractmethod
async def coro_unless_closed(self, coro):
pass

@abstractmethod
def prevent_close(self):
pass

@abstractmethod
def start(self):
pass

@abstractmethod
def stop(self):
pass

@abstractmethod
def close(self, args):
"""
Requests the GUI application to close.
The window itself will be closed in the closing sequence later.
"""
pass

@abstractmethod
def close_window(self):
"""
Closes the window. Invalidates the logger.
"""
pass

@abstractmethod
def unfocus(self, event):
pass

@abstractmethod
def save(self, force):
pass

@abstractmethod
def set_games(self, games):
pass

@abstractmethod
def display_drop(self, drop, countdown, subone):
pass

@abstractmethod
def clear_drop(self):
pass

@abstractmethod
def print(self, message):
pass
Loading