Skip to content

Commit

Permalink
0.11.0
Browse files Browse the repository at this point in the history
Merge pull request #59 from hephy-dd/devel0.11.0
  • Loading branch information
arnobaer authored Aug 26, 2020
2 parents d241189 + bf1f1a2 commit 7d8272b
Show file tree
Hide file tree
Showing 49 changed files with 2,022 additions and 1,311 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See the documentation on https://hephy-dd.github.io/comet/
Install from GitHub using pip

```bash
pip install git+https://github.com/hephy-dd/comet.git@0.10.3
pip install git+https://github.com/hephy-dd/comet.git@0.11.0
```

## Quick start
Expand All @@ -29,6 +29,7 @@ field and a button.

```python
import comet
from comet import ui

# Create application
app = comet.Application("example")
Expand All @@ -49,14 +50,14 @@ def on_update():
text.value = instr.identification

# Create UI layout
text = comet.Text(readonly=True)
button = comet.Button(text="Read IDN", clicked=on_update)
app.layout = comet.Column(
comet.Row(
text = ui.Text(readonly=True)
button = ui.Button(text="Read IDN", clicked=on_update)
app.layout = ui.Column(
ui.Row(
text_field,
button
),
comet.Stretch()
ui.Stretch()
)

# Run event loop
Expand Down
5 changes: 3 additions & 2 deletions comet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import time
import random

from . import ui

from .application import *
from .ui import *
from .process import *
from .driver import *
from .driver import Driver, IEC60488
from .resource import *
from .functions import Range
from .ureg import *
Expand Down
42 changes: 22 additions & 20 deletions comet/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from qutie.qt import QtGui

from .version import __version__
from .widgets import MainWindow
from .ui.mainwindow import MainWindow
from .settings import SettingsMixin
from .resource import ResourceMixin
from .process import ProcessMixin
Expand Down Expand Up @@ -36,10 +36,10 @@ def __init__(self, name=None, *, title=None, width=None,
self.icon = make_path('assets', 'icons', 'comet.svg')

# Connections
self.qt.lastWindowClosed.connect(self.qt.quit)
self.last_window_closed = self.qt.quit

# Initialize main window
self.qt.window = MainWindow()
self.__window = MainWindow()
self.__widget = ui.Widget()

# Main window properties
Expand All @@ -52,39 +52,39 @@ def __init__(self, name=None, *, title=None, width=None,
if height is not None:
self.height = height

self.qt.window.setCentralWidget(self.__widget.qt)
self.window.layout = self.__widget

@property
def title(self):
return self.qt.window.windowTitle()
return self.window.title

@title.setter
def title(self, value):
self.qt.window.setWindowTitle(value)
self.window.title = value

@property
def width(self):
return self.qt.window.width()
return self.window.width

@width.setter
def width(self, width):
self.qt.window.resize(width, self.height)
self.window.width = width

@property
def height(self):
return self.qt.window.height()
return self.window.height

@height.setter
def height(self, height):
self.qt.window.resize(self.width, height)
self.window.height = height

@property
def about(self):
return self.qt.window.aboutText()
return self.window.about_text

@about.setter
def about(self, value):
self.qt.window.setAboutText(value)
self.window.about_text = value

@property
def message(self):
Expand All @@ -94,9 +94,9 @@ def message(self):
def message(self, message):
self.__message = message
if message is None:
self.qt.window.clearMessage()
self.window.hide_message()
else:
self.qt.window.showMessage(message)
self.window.show_message(message)

@property
def progress(self):
Expand All @@ -106,25 +106,27 @@ def progress(self):
def progress(self, args):
self.__progress = args
if args is None:
self.qt.window.hideProgress()
self.window.hide_progress()
else:
self.qt.window.showProgress(*args[:2])
self.window.show_progress(*args[:2])

@property
def window(self):
return self.__window

@property
def layout(self):
return self.__widget.layout

@layout.setter
def layout(self, layout):
if callable(layout):
layout = layout()
self.__widget.layout = layout

def run(self):
"""Run application event loop."""
# Show main window
self.qt.window.show()
self.qt.window.raise_()
self.window.show()
self.window.up()

# Run event loop
result = super().run()
Expand Down
1 change: 1 addition & 0 deletions comet/driver/hephy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .brandbox import *
from .shuntbox import *
from .environmentbox import *
Loading

0 comments on commit 7d8272b

Please sign in to comment.