packaging via poetry

This commit is contained in:
Roberto Alsina 2020-02-01 16:49:26 -03:00
parent 8cfd0072cd
commit 90fe2990bc
6 changed files with 35 additions and 6 deletions

View File

@ -14,7 +14,7 @@ So I went and wrote one.
## To try: ## To try:
If you have PySide2: `python main.py` in the folder where main.py is located. If you have PySide2: `python -m xrandroll` in the folder where main.py is located.
## TODO: ## TODO:

24
pyproject.toml Normal file
View File

@ -0,0 +1,24 @@
[tool.poetry]
name = "xrandroll"
version = "0.1.0"
description = "A powertool to configure your display"
authors = ["Roberto Alsina <roberto.alsina@gmail.com>"]
license = "MIT"
readme = "README.md"
packages = [
{ include = "xrandroll" }
]
[tool.poetry.dependencies]
pyside2 = ">5.14"
python = ">3.6"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tool.poetry.scripts]
xrandroll = 'xrandroll:main'

1
xrandroll/__init__.py Normal file
View File

@ -0,0 +1 @@
from .__main__ import main

View File

@ -1,13 +1,14 @@
from copy import deepcopy import os
import shlex import shlex
import subprocess import subprocess
import sys import sys
from copy import deepcopy
from PySide2.QtCore import QFile, QObject from PySide2.QtCore import QFile, QObject
from PySide2.QtUiTools import QUiLoader from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import QApplication, QGraphicsScene, QLabel from PySide2.QtWidgets import QApplication, QGraphicsScene, QLabel
from monitor_item import MonitorItem from .monitor_item import MonitorItem
def gen_xrandr_from_data(data): def gen_xrandr_from_data(data):
@ -373,14 +374,17 @@ class Window(QObject):
self.ui.verticalScaleLabel.setText(f"{int(self.ui.verticalScale.value()/10)}%") self.ui.verticalScaleLabel.setText(f"{int(self.ui.verticalScale.value()/10)}%")
self.mode_changed() # Not really, but it's the same thing self.mode_changed() # Not really, but it's the same thing
def main():
if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
ui_file = QFile("main.ui") ui_file = QFile(os.path.join(os.path.dirname(__file__), "main.ui"))
ui_file.open(QFile.ReadOnly) ui_file.open(QFile.ReadOnly)
loader = QUiLoader() loader = QUiLoader()
window = Window(loader.load(ui_file)) window = Window(loader.load(ui_file))
sys.exit(app.exec_()) sys.exit(app.exec_())
if __name__ == "__main__":
main()