forked from DPCS-team/DPCS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'eaf77770c8acead50b8536b8c4fc33a2db907ea9'
- Loading branch information
Showing
62 changed files
with
1,724 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: python | ||
python: | ||
- '2.6' | ||
- '2.7' | ||
install: | ||
- pip install pytest pep8 requests gi | ||
script: | ||
- pep8 --ignore=E402,E121,E123,E126,E226,E24,E704 client server | ||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
PYTHON=python2 | ||
DESTDIR=/ | ||
BUILDIR=$(CURDIR)/debian/dpcs | ||
PROJECT=dpcs | ||
VERSION=0.1.0 | ||
|
||
all: | ||
@echo "make source - Create source package" | ||
@echo "make install - Install on local system" | ||
@echo "make buildrpm - Generate a rpm package" | ||
@echo "make builddeb - Generate a deb package" | ||
@echo "make clean - Get rid of scratch and byte files" | ||
|
||
source: | ||
$(PYTHON) setup.py sdist $(COMPILE) | ||
|
||
install: | ||
$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE) | ||
|
||
buildrpm: | ||
$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall | ||
|
||
builddeb: | ||
# build the source package in the parent directory | ||
# then rename it to project_version.orig.tar.gz | ||
$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ | ||
rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../* | ||
# build the package | ||
dpkg-buildpackage -i -I -rfakeroot | ||
|
||
clean: | ||
$(PYTHON) setup.py clean | ||
$(MAKE) -f $(CURDIR)/debian/rules clean | ||
rm -rf build/ MANIFEST | ||
find . -name '*.pyc' -delete |
0
systemcheck/__init__.py → client/configure
100644 → 100755
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dnl autoconf stub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dpcs (0.1) UNRELEASED; urgency=low | ||
|
||
* Initial release. | ||
|
||
-- Marek Bardoński <[email protected]> Mon, 14 Mar 2016 17:22:58 +0100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
+7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Source: dpcs | ||
Section: python | ||
Priority: optional | ||
Maintainer: Marek Bardoński, <[email protected]> | ||
Build-Depends: debhelper (>= 7), | ||
python (>= 2.6.6-3~), | ||
python-requests (>= 2.2), | ||
python-gi (>= 3.12) | ||
Standards-Version: 3.9.2 | ||
X-Python-Version: >= 2.6 | ||
|
||
Package: dpcs | ||
Architecture: all | ||
Section: python | ||
Depends: ${misc:Depends}, ${python:Depends} | ||
Description: An application, that would help Ubuntu users in effortless problem solving. | ||
An application for automatic problem solving in Ubuntu OS. In short, our application would first gather large amount of data concerning crashes of application that Ubuntu users have encountered during their work. Next we would analyze those errors and find solutions. Based on the resulting database, a user would be proposed a solution for an error that he encounters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: dpcs | ||
Upstream-Contact: Marek Bardoński <[email protected]> | ||
|
||
Files: * | ||
Copyright: 2016, dpcs-team, <[email protected]> | ||
License: LGPL-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/make -f | ||
# -*- makefile -*- | ||
|
||
include /usr/share/cdbs/1/rules/debhelper.mk | ||
include /usr/share/cdbs/1/class/python-autotools.mk | ||
|
||
DEB_PYTHON2_MODULE_PACKAGES = dpcs | ||
|
||
clean:: | ||
rm -rf build build-stamp configure-stamp build/ MANIFEST | ||
dh_clean |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Utilities for handling settings.""" | ||
import json | ||
import os | ||
|
||
# config file path | ||
DEFAULT_SERVER_ADDRESS = "http://private-a6e53-dpcs.apiary-mock.com/" | ||
FILE = os.path.expanduser('~/.dpcs/.dpcsconfig') | ||
|
||
|
||
def read_settings(): | ||
with open(FILE, 'r') as f: | ||
try: | ||
settings = json.load(f) | ||
if 'server_address' not in settings: | ||
settings['server_address'] = DEFAULT_SERVER_ADDRESS | ||
except ValueError: | ||
settings = {'server_address': DEFAULT_SERVER_ADDRESS} | ||
return settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
#!/usr/bin/env python2 | ||
|
||
import json | ||
import pgi as gi | ||
gi.install_as_gi() | ||
gi.require_version('Gtk', '3.0') | ||
from gi.repository import Gtk | ||
import os.path | ||
|
||
from dpcs_client.settings import DEFAULT_SERVER_ADDRESS | ||
from dpcs_client.settings import FILE | ||
from dpcs_client.settings import read_settings | ||
|
||
# the window title | ||
PANELTITLE = "DPCS Settings" | ||
|
||
# about DPCS - authors, basic info, licensing and such... | ||
ABOUT_DPCS = """AI powered agent, running locally on your machine, | ||
analyzing what's going on in the logs and overall on the system, | ||
and advertizing what's wrong, then, hopefully, | ||
offer an answer to help you fix it. | ||
""" | ||
|
||
|
||
# minimal window width and height | ||
WIDTH = 600 | ||
HEIGHT = 200 | ||
|
||
|
||
def displaypanel(): | ||
""" displays the prefs dialog | ||
""" | ||
win = SettingsPanel() | ||
win.show_all() | ||
Gtk.main() | ||
|
||
|
||
class SettingsPanel(Gtk.Window): | ||
""" The preferences dialog for DPCS""" | ||
|
||
def __init__(self): | ||
Gtk.Window.__init__(self, title=PANELTITLE) | ||
self.set_size_request(WIDTH, HEIGHT) | ||
|
||
maincontainer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, | ||
spacing=0) | ||
self.add(maincontainer) | ||
|
||
notebook = Gtk.Notebook() | ||
maincontainer.pack_start(notebook, True, True, 0) | ||
|
||
buttonscontainer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) | ||
maincontainer.pack_start(buttonscontainer, False, False, 0) | ||
|
||
# settings tab | ||
|
||
settingspage = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5) | ||
|
||
settings = read_settings() | ||
settingspage.pack_start(self.addTextField('Server address', | ||
settings['server_address']), | ||
True, True, 0) | ||
|
||
# end of setting boxes | ||
|
||
notebook.append_page(settingspage, Gtk.Label('Settings')) | ||
|
||
# about DPCS tab | ||
|
||
aboutpage = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5) | ||
|
||
acontent = Gtk.Label() | ||
acontent.set_text(ABOUT_DPCS) | ||
acontent.set_justify(Gtk.Justification.LEFT) | ||
aboutpage.pack_start(acontent, True, True, 0) | ||
|
||
notebook.append_page(aboutpage, Gtk.Label('About DPCS')) | ||
|
||
# ok, apply and cancel buttons | ||
|
||
self.ok = Gtk.Button(label="Ok") | ||
cancel = Gtk.Button(label="Cancel") | ||
restore = Gtk.Button(label="Restore default") | ||
applyb = Gtk.Button(label="Apply") | ||
|
||
buttonscontainer.pack_end(self.ok, False, False, 0) | ||
buttonscontainer.pack_end(applyb, False, False, 0) | ||
buttonscontainer.pack_end(restore, False, False, 0) | ||
buttonscontainer.pack_end(cancel, False, False, 0) | ||
|
||
cancel.connect("clicked", Gtk.main_quit) | ||
applyb.connect("clicked", self.applysettings) | ||
restore.connect("clicked", self.restoresettings) | ||
self.ok.connect("clicked", self.applysettings) | ||
|
||
# loads current config | ||
self.loadconfig() | ||
self.connect("delete-event", Gtk.main_quit) | ||
|
||
def addTextField(self, label, default_text): | ||
self.entry = Gtk.Entry() | ||
self.entry.set_text(default_text) | ||
label_gtk = Gtk.Label(label) | ||
table = Gtk.Table(1, 3, True) | ||
table.attach(label_gtk, 0, 1, 0, 1) | ||
table.attach(self.entry, 1, 3, 0, 1) | ||
return table | ||
|
||
def applysettings(self, widget): | ||
""" writes settings to dpcs.config, exits | ||
if ok has been pressed | ||
""" | ||
conf_directory = os.path.dirname(FILE) | ||
|
||
if not os.path.exists(conf_directory): | ||
os.makedirs(conf_directory) | ||
|
||
f = open(FILE, 'w') | ||
|
||
settings = {'server_address': self.entry.get_text()} | ||
json.dump(settings, f, indent=2) | ||
f.close() | ||
if widget == self.ok: | ||
Gtk.main_quit() | ||
|
||
def restoresettings(self, widget): | ||
"""Restore default settings.""" | ||
conf_directory = os.path.dirname(FILE) | ||
|
||
if not os.path.exists(conf_directory): | ||
os.makedirs(conf_directory) | ||
|
||
f = open(FILE, 'w') | ||
|
||
settings = {'server_address': DEFAULT_SERVER_ADDRESS} | ||
json.dump(settings, f, indent=2) | ||
f.close() | ||
|
||
self.entry.set_text(DEFAULT_SERVER_ADDRESS) | ||
|
||
def loadconfig(self): | ||
""" loads current settings from dpcs.config | ||
""" | ||
with open(FILE, 'r') as f: | ||
try: | ||
settings = json.load(f) | ||
if 'server_address' in settings: | ||
self.entry.set_text(settings['server_address']) | ||
except ValueError: | ||
pass | ||
|
||
if __name__ == "__main__": | ||
displaypanel() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.