From 0b607a7e64d776435e529142384df3b941f75879 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 17 Apr 2020 18:45:39 -0700 Subject: [PATCH] removed python/kivy things --- freechat-client/requirements.txt | 2 - freechat-client/src/client.py | 35 ---------- freechat-client/src/configuration.py | 8 --- freechat-client/src/core.py | 96 ---------------------------- 4 files changed, 141 deletions(-) delete mode 100644 freechat-client/requirements.txt delete mode 100644 freechat-client/src/client.py delete mode 100644 freechat-client/src/configuration.py delete mode 100644 freechat-client/src/core.py diff --git a/freechat-client/requirements.txt b/freechat-client/requirements.txt deleted file mode 100644 index 6fd721c..0000000 --- a/freechat-client/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -PySide2==5.14.1 -shiboken2==5.14.1 diff --git a/freechat-client/src/client.py b/freechat-client/src/client.py deleted file mode 100644 index f46e7d9..0000000 --- a/freechat-client/src/client.py +++ /dev/null @@ -1,35 +0,0 @@ -# main entry point module for the app - -import os, sys, json -from os.path import expanduser -from PySide2.QtQuick import QQuickView -from PySide2.QtCore import QStringListModel, Qt -from PySide2.QtGui import QGuiApplication - -def load_config(): - with open(expanduser('~') + '/.config/freechat-client/config.json') as cfg: - data = json.load(cfg) - - return data - - - -if __name__ == '__main__': - config = load_config() - # setup the window - server_names = [name for name in config['servers']] - app = QGuiApplication([]) - view = QQuickView() - view.setResizeMode(QQuickView.SizeRootObjectToView) - - listmodel = QStringListModel() - listmodel.setStringList(server_names) - view.rootContext().setContextProperty('listModel', listmodel) - - if view.status() == QQuickView.Error: - sys.exit(1) - - else: - view.show() - app.exec_() - del view diff --git a/freechat-client/src/configuration.py b/freechat-client/src/configuration.py deleted file mode 100644 index d26b558..0000000 --- a/freechat-client/src/configuration.py +++ /dev/null @@ -1,8 +0,0 @@ -''' -Basic user configurations are handled via a basic json file -''' -import json - -class UserConfig(object): - pass - diff --git a/freechat-client/src/core.py b/freechat-client/src/core.py deleted file mode 100644 index 10dc1b3..0000000 --- a/freechat-client/src/core.py +++ /dev/null @@ -1,96 +0,0 @@ -# main entry point - -import sys, os -from os.path import expanduser -import json -from PySide2.QtCore import Slot, qApp -from PySide2.QtGui import QKeySequence -from PySide2.QtWidgets import QMainWindow, QAction, QHeaderView, QSizePolicy, \ - QTableView, QWidget, QApplication -from PySide2.QtCore import Qt, QAbstractTableModel, QModelIndex -from PySide2.QtGui import QColor - -''' -Here we find general UI elements -Most callbacks to networked functionality and data handling is found in other, more relevant modules -''' - - -class MainWindow(QMainWindow): - def __init__(self, widget): - QMainWindow.__init__(self) - self.setWindowTitle('Freechat') - self.setCentralWidget(widget) - - # Exit action - exit_action = QAction('Exit', self) - exit_action.setShortcut(QKeySequence.Quit) - exit_action.triggered.connect(self.close) - - # Window dimensions - geometry = qApp.desktop().availableGeometry(self) - self.setFixedSize(geometry.width() * 0.8, geometry.height() * 0.6) - - -class ServerList(QAbstractTableModel): - def __init__(self, data=None): - QAbstractTableModel.__init__(self) - self.load_server_list(data) - - def load_server_list(self, data): - ''' - at this point we assume that - a. the config has been loaded from somewhere - b. its actually there - ''' - # Data here is meant to be a list of dictionary's - self._server_names = [serv['name'] for serv in data] - self.b_server_descs = [serv['description'] for serv in data] - - self.column_count = 2 - self.row_count = len(self._server_names) - - def rowCount(self, parent=QModelIndex()): - return self.row_count - - def columnCount(self, parent=QModelIndex()): - return self.column_count - - -class Widget(QWidget): - def __init__(self, data): - QWidget.__init__(self) - - self.model = ServerList(data) - self.table_view = QTableView() - - # table headers - self.horizontal_header = self.table_view.horizontalHeader() - - -def read_whole_config(): - _config = {} - with open(expanduser('~') + '/.config/freechat-client/config.json') as cfg: - _config = json.load(cfg) - - return _config - - - -if __name__ == '__main__': - config = read_whole_config() - server_list = config['servers'] - username = config['global-username'] - app = QApplication([]) - - widget = Widget(server_list) - window = MainWindow(widget) - window.show() - - sys.exit(app.exec_()) - - - - - -