removed python/kivy things

This commit is contained in:
shockrahwow 2020-04-17 18:45:39 -07:00
parent 6e9c485d69
commit 0b607a7e64
4 changed files with 0 additions and 141 deletions

View File

@ -1,2 +0,0 @@
PySide2==5.14.1
shiboken2==5.14.1

View File

@ -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

View File

@ -1,8 +0,0 @@
'''
Basic user configurations are handled via a basic json file
'''
import json
class UserConfig(object):
pass

View File

@ -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_())