-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pool Server Configurator implementation.
- Loading branch information
Laurence Trippen
committed
Apr 2, 2019
1 parent
ba2d2cb
commit ae6d1ee
Showing
6 changed files
with
104 additions
and
2 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,6 @@ | ||
rem Name=Configure Pool Server | ||
rem Icon=afanasy.png | ||
rem Separator | ||
call %0\..\_setup.cmd | ||
|
||
"%CGRU_PYTHONEXE%" "%CGRU_LOCATION%\utilities\poolssupport\poolserver\configurator.py" %* |
File renamed without changes.
Binary file modified
BIN
+0 Bytes
(100%)
utilities/poolssupport/poolserver/__pycache__/config.cpython-34.pyc
Binary file not shown.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"max_clients": 32, | ||
"port": 9999, | ||
"ip": "" | ||
"ip": "", | ||
"port": 9999 | ||
} |
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,93 @@ | ||
# Encoding: UTF-8 | ||
# Author: Laurence Trippen | ||
# Date: 02.04.2019 | ||
# E-Mail: [email protected] | ||
# Program: Afanasy Pool Server Configurator - Main | ||
|
||
import os | ||
import sys | ||
import cgruutils | ||
|
||
from Qt import QtCore, QtGui, QtWidgets | ||
from config import Config | ||
|
||
# MainWindow class | ||
class MainWindow(QtWidgets.QWidget): | ||
def __init__(self): | ||
QtWidgets.QWidget.__init__(self) | ||
self.setFixedSize(340, 125) | ||
self.initUI() | ||
self.load() | ||
|
||
# UI initialization | ||
def initUI(self): | ||
# Window Title | ||
self.setWindowTitle('Pool Server Configurator CGRU %s' % | ||
os.getenv('CGRU_VERSION', '')) | ||
|
||
# Window icon | ||
iconpath = cgruutils.getIconFileName('afanasy') | ||
if iconpath is not None: | ||
self.setWindowIcon(QtGui.QIcon(iconpath)) | ||
|
||
self.ipLabel = QtWidgets.QLabel("Binding IP:") | ||
self.ipLineEdit = QtGui.QLineEdit() | ||
self.ipLineEdit.setPlaceholderText("If empty localhost is set.") | ||
self.ipLayout = QtWidgets.QHBoxLayout() | ||
self.ipLayout.addWidget(self.ipLabel) | ||
self.ipLayout.addWidget(self.ipLineEdit) | ||
|
||
self.portLabel = QtWidgets.QLabel("Port:") | ||
self.portSpinBox = QtGui.QSpinBox() | ||
self.portSpinBox.setMinimum(0) | ||
self.portSpinBox.setMaximum(65535) | ||
self.portLayout = QtWidgets.QHBoxLayout() | ||
self.portLayout.addWidget(self.portLabel) | ||
self.portLayout.addWidget(self.portSpinBox) | ||
|
||
self.maxClientsLabel = QtWidgets.QLabel("Max. Clients: (Renderfarm clients.)") | ||
self.maxClientsSpinBox = QtGui.QSpinBox() | ||
self.maxClientsSpinBox.setMinimum(0) | ||
self.maxClientsSpinBox.setMaximum(100000) | ||
self.maxClientsLayout = QtWidgets.QHBoxLayout() | ||
self.maxClientsLayout.addWidget(self.maxClientsLabel) | ||
self.maxClientsLayout.addWidget(self.maxClientsSpinBox) | ||
|
||
self.saveButton = QtWidgets.QPushButton("Save") | ||
self.saveButton.clicked.connect(self.save) | ||
|
||
# Top Root Layout | ||
self.topLayout = QtWidgets.QVBoxLayout(self) | ||
self.topLayout.addLayout(self.ipLayout) | ||
self.topLayout.addLayout(self.portLayout) | ||
self.topLayout.addLayout(self.maxClientsLayout) | ||
self.topLayout.addWidget(self.saveButton) | ||
|
||
# Loads config | ||
def load(self): | ||
Config.check() | ||
Config.load() | ||
self.ipLineEdit.setText(Config.ip) | ||
self.portSpinBox.setValue(Config.port) | ||
self.maxClientsSpinBox.setValue(Config.max_clients) | ||
|
||
# Saves config | ||
def save(self): | ||
Config.save({ | ||
"ip":self.ipLineEdit.text(), | ||
"port":self.portSpinBox.value(), | ||
"max_clients":self.maxClientsSpinBox.value() | ||
}) | ||
self.close() | ||
|
||
if __name__ == "__main__": | ||
if "CGRU_LOCATION" in os.environ: | ||
print("CGRU_LOCATION=" + os.environ['CGRU_LOCATION']) | ||
else: | ||
print("CGRU_LOCATION is not set!") | ||
sys.exit() | ||
|
||
app = QtWidgets.QApplication(sys.argv) | ||
window = MainWindow() | ||
window.show() | ||
sys.exit(app.exec_()) |
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,3 @@ | ||
@echo off | ||
|
||
call %CGRU_LOCATION%\start\AFANASY\afpoolserverconfig.cmd |