commit 02f38da1a65d9297e4dbc56c0375fe590b6e546c Author: Denis Tereshkin Date: Wed Mar 28 08:41:18 2018 +0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19016ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.* +bin/* +dist/* +build/* +*.pyc +src/*.egg-info/* + diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..e69de29 diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..5744678 --- /dev/null +++ b/setup.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +from __future__ import absolute_import +from __future__ import print_function + +import io +import re +from glob import glob +from os.path import basename +from os.path import dirname +from os.path import join +from os.path import splitext + +from setuptools import find_packages +from setuptools import setup + + +def read(*names, **kwargs): + return io.open( + join(dirname(__file__), *names), + encoding=kwargs.get('encoding', 'utf8') + ).read() + + +setup( + name='nailab', + version='0.1.0', + license='BSD 2-Clause License', + description='Naiback lab', + long_description='%s\n%s' % ( + re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), + re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst')) + ), + author='Denis Tereshkin', + author_email='denis@kasan.ws', + url='https://github.com/asakul/nailab', + packages=find_packages('src'), + package_dir={'': 'src'}, + py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], + include_package_data=True, + zip_safe=False, + classifiers=[ + # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 1 - Planning', + 'Intended Audience :: Financial and Insurance Industry', + 'License :: OSI Approved :: MIT License', + 'Operating System :: Unix', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Office/Business :: Financial' + ], + keywords=[ + 'backtesting' + ], + install_requires=[ + 'naiback' + ], + extras_require={ + }, + entry_points={ + }, +) diff --git a/src/nailab/__init__.py b/src/nailab/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/nailab/data/csvfolderdatasource.py b/src/nailab/data/csvfolderdatasource.py new file mode 100644 index 0000000..75ef13b --- /dev/null +++ b/src/nailab/data/csvfolderdatasource.py @@ -0,0 +1,25 @@ + +from nailab.data.datasource import DataSource + +import glob +import os + +class CsvFolderDataSource(DataSource): + + def __init__(self, name, path): + super().__init__(name) + + self.path = path + self._discover_feeds() + self.feeds = [] + + def available_feeds(self): + return self.feeds + + def get_feed(self, feed_id): + pass + + def _discover_feeds(self): + files = glob.glob(self.path + '/*.csv') + self.feeds = [os.path.basename(f) for f in files] + diff --git a/src/nailab/data/datasource.py b/src/nailab/data/datasource.py new file mode 100644 index 0000000..d41e95d --- /dev/null +++ b/src/nailab/data/datasource.py @@ -0,0 +1,11 @@ + +class DataSource: + + def __init__(self, name): + self.name = name + + def available_feeds(self): + pass + + def get_feed(self, feed_id): + pass diff --git a/src/nailab/nailab.py b/src/nailab/nailab.py new file mode 100644 index 0000000..06e2446 --- /dev/null +++ b/src/nailab/nailab.py @@ -0,0 +1,21 @@ + +import gi +gi.require_version('Gtk', '3.0') +gi.require_version('GtkSource', '3.0') +from gi.repository import Gtk, GObject +from gi.repository import GtkSource + +from ui.applicationwindow import ApplicationWindow + +def main(): + GObject.type_register(GtkSource.View) + + builder = Gtk.Builder() + builder.add_from_file('ui/nailab.glade') + + ApplicationWindow(builder) + + Gtk.main() + +if __name__ == '__main__': + main() diff --git a/src/nailab/ui/applicationwindow.py b/src/nailab/ui/applicationwindow.py new file mode 100644 index 0000000..7a6485f --- /dev/null +++ b/src/nailab/ui/applicationwindow.py @@ -0,0 +1,21 @@ + +from gi.repository import Gtk, GtkSource + +class ApplicationWindow: + + def __init__(self, builder): + self.window = builder.get_object('ApplicationWindow') + manager = GtkSource.LanguageManager() + buf = GtkSource.Buffer() + buf.set_language(manager.get_language('python')) + sv = builder.get_object('sourceview') + sv.set_buffer(buf) + sv.set_monospace(True) + + handlers = { + 'on_ApplicationWindow_delete_event' : Gtk.main_quit + } + + builder.connect_signals(handlers) + self.window.show_all() + diff --git a/src/nailab/ui/nailab.glade b/src/nailab/ui/nailab.glade new file mode 100644 index 0000000..b4c3af8 --- /dev/null +++ b/src/nailab/ui/nailab.glade @@ -0,0 +1,205 @@ + + + + + + + + + + Normal + monospace + + + + + texttagtable + <default>foo</default> + + + 1024 + 768 + False + 2 + + + + True + False + 0 + none + + + True + True + 200 + True + + + True + True + model_dataSources + + + + + + False + True + + + + + True + True + word-char + textbuffer + True + True + True + 4 + True + True + True + True + + + True + True + + + + + + + True + False + + + True + False + _Файл + True + + + True + False + + + gtk-new + True + False + True + True + + + + + gtk-open + True + False + True + True + + + + + gtk-save + True + False + True + True + + + + + gtk-save-as + True + False + True + True + + + + + True + False + + + + + gtk-quit + True + False + True + True + + + + + + + + + True + False + _Правка + True + + + True + False + + + gtk-cut + True + False + True + True + + + + + gtk-copy + True + False + True + True + + + + + gtk-paste + True + False + True + True + + + + + gtk-delete + True + False + True + True + + + + + + + + + True + False + _Вид + True + + + + + + + +