Skip to content
Open
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
13 changes: 10 additions & 3 deletions app.py → sclack/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import traceback
import tempfile
import urwid
import signal
from datetime import datetime
from sclack.components import Attachment, Channel, ChannelHeader, ChatBox, Dm
from sclack.components import Indicators, MarkdownText, MessageBox
Expand Down Expand Up @@ -62,6 +63,7 @@ def __init__(self, config):
self.set_snooze_widget = None
self.workspaces = list(config['workspaces'].items())
self.store = Store(self.workspaces, self.config)
signal.signal(signal.SIGINT, self.quit_application)
Store.instance = self.store
urwid.set_encoding('UTF-8')
sidebar = LoadingSideBar()
Expand Down Expand Up @@ -907,7 +909,7 @@ def configure_screen(self, screen):
if self.workspaces_line is not None:
urwid.connect_signal(self.workspaces_line, 'switch_workspace', self.switch_to_workspace)

def quit_application(self):
def quit_application(self, *args):
self.urwid_loop.stop()
if hasattr(self, 'real_time_task'):
self.real_time_task.cancel()
Expand All @@ -930,10 +932,15 @@ def ask_for_token(json_config):
config_file.write(json.dumps(token_config, indent=False))
json_config.update(token_config)

if __name__ == '__main__':
def run():
json_config = {}
with open('./config.json', 'r') as config_file:
config_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'config.json')
with open(config_file, 'r') as config_file:
json_config.update(json.load(config_file))
ask_for_token(json_config)
app = App(json_config)
app.start()

if __name__ == '__main__':
run()
File renamed without changes.
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
author='Marcelo Camargo',
author_email='[email protected]',
url='https://github.com/haskellcamargo/sclack',
scripts=["app.py"],
entry_points={
'console_scripts': [
'sclack=sclack.app:run',
],
},
package_data={
'sclack': ['config.json']
},
packages=find_packages(),
install_requires=[
'asyncio',
Expand Down