Skip to content

Commit

Permalink
ENH: add bare bones vcp's to test video cards
Browse files Browse the repository at this point in the history
  • Loading branch information
jethornton committed Mar 24, 2019
1 parent f7d367c commit 91b8b6d
Show file tree
Hide file tree
Showing 15 changed files with 698 additions and 0 deletions.
40 changes: 40 additions & 0 deletions video_tests/opengl_test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python

"""Main entry point for opengl_test.
This module contains the code necessary to be able to launch QControl
directly from the command line, without using qtpyvcp. It handles
parsing command line args and starting the main application.
Example:
Assuming the dir this file is located in is on the PATH, you can
launch opengl_test by saying::
$ opengl_test --ini=/path/to/config.ini [options ...]
Run with the --help option to print a full list of options.
"""

__version__ = '0.0.1'

import os
import qtpyvcp

VCP_DIR = os.path.realpath(os.path.dirname(__file__))
VCP_CONFIG_FILE = os.path.join(VCP_DIR, 'config.yml')


def main(opts=None):

if opts is None:
from qtpyvcp.utilities.opt_parser import parse_opts
opts = parse_opts(vcp_cmd='opengl_test',
vcp_name='opengl_test',
vcp_version=__version__)

qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)


if __name__ == '__main__':
main()
50 changes: 50 additions & 0 deletions video_tests/opengl_test/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Include the QtPyVCP default menubar.
{% include "default_menubar.yml" %}

qtdesigner:
ui_file: ( windows.mainwindow.kwargs.ui_file )
qss_file: ( application.kwargs.stylesheet )

vcp:
name: opengl_test
version: v0.0.1
author: My Name
description: >
Put a short description of your VCP here. This will be
shown in the VCP Chooser when launching QtPyVCP with the
--chooser option.
Examples of what to included here:
* VCP Features
* Type of machine the VCP is for
* Development status
* Acknowledgments
data_plugins:
status:
kwargs:
cycle_time: 75

windows:

mainwindow:
# Specify the class to use for the VCP's mainwindow
# Format: package.module:class
provider: opengl_test.mainwindow:MyMainWindow

# Keyword arguments to pass when initializing the class.
kwargs:
# Specify the mainwindow menubar as the default.
menu: ( default_menubar )
# Specify the UI file to load the window layout from.
ui_file: {{ file.dir }}/mainwindow.ui
# Specify a stylesheet to use only for mainwindow.
stylesheet: null
# Set the window title from from the date in the vcp section above.
title: ( vcp.name ) ( vcp.version)

application:
kwargs:
# Specify the application wide stylesheet.
stylesheet: {{ file.dir }}/style.qss
15 changes: 15 additions & 0 deletions video_tests/opengl_test/mainwindow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow

# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)

class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)

# add any custom methods here
def on_exitBtn_clicked(self):
self.app.quit()

104 changes: 104 additions & 0 deletions video_tests/opengl_test/mainwindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>400</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="verticalWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>OpenGl Works</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="GcodeBackplot" name="gcodebackplot"/>
</item>
<item>
<widget class="QPushButton" name="exitBtn">
<property name="text">
<string>Quit</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionOPEN">
<property name="text">
<string>oPEN</string>
</property>
</action>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionFullscreen">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Fullscreen</string>
</property>
<property name="shortcut">
<string>F11</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>GcodeBackplot</class>
<extends>QWidget</extends>
<header>qtpyvcp.widgets.display_widgets.gcode_backplot.gcode_backplot</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
28 changes: 28 additions & 0 deletions video_tests/opengl_test/style.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
QsciScintilla {
qproperty-backgroundcolor: #D9DADB;
qproperty-marginbackgroundcolor: #D9DADB;
}

ActionButton[actionName="machine.estop.toggle"]:checked{
background: rgb(239, 41, 41);
}

ActionButton[actionName="machine.power.toggle"]:checked{
background:rgb(138, 226, 52);
}

ActionButton[actionName="program.run"]:enabled{
background:rgb(138, 226, 52);
}

ActionButton[actionName="program.step"]:enabled{
background:rgb(138, 226, 52);
}

ActionButton[actionName="program.pause"]:enabled{
background:rgb(252, 233, 79);
}

ActionButton[actionName="program.abort"]:enabled{
background: rgb(239, 41, 41);
}
40 changes: 40 additions & 0 deletions video_tests/qtpyvcp_test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python

"""Main entry point for no_graphics_test.
This module contains the code necessary to be able to launch QControl
directly from the command line, without using qtpyvcp. It handles
parsing command line args and starting the main application.
Example:
Assuming the dir this file is located in is on the PATH, you can
launch no_graphics_test by saying::
$ no_graphics_test --ini=/path/to/config.ini [options ...]
Run with the --help option to print a full list of options.
"""

__version__ = '0.0.1'

import os
import qtpyvcp

VCP_DIR = os.path.realpath(os.path.dirname(__file__))
VCP_CONFIG_FILE = os.path.join(VCP_DIR, 'config.yml')


def main(opts=None):

if opts is None:
from qtpyvcp.utilities.opt_parser import parse_opts
opts = parse_opts(vcp_cmd='no_graphics_test',
vcp_name='no_graphics_test',
vcp_version=__version__)

qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)


if __name__ == '__main__':
main()
50 changes: 50 additions & 0 deletions video_tests/qtpyvcp_test/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Include the QtPyVCP default menubar.
{% include "default_menubar.yml" %}

qtdesigner:
ui_file: ( windows.mainwindow.kwargs.ui_file )
qss_file: ( application.kwargs.stylesheet )

vcp:
name: no_graphics_test
version: v0.0.1
author: My Name
description: >
Put a short description of your VCP here. This will be
shown in the VCP Chooser when launching QtPyVCP with the
--chooser option.
Examples of what to included here:
* VCP Features
* Type of machine the VCP is for
* Development status
* Acknowledgments
data_plugins:
status:
kwargs:
cycle_time: 75

windows:

mainwindow:
# Specify the class to use for the VCP's mainwindow
# Format: package.module:class
provider: no_graphics_test.mainwindow:MyMainWindow

# Keyword arguments to pass when initializing the class.
kwargs:
# Specify the mainwindow menubar as the default.
menu: ( default_menubar )
# Specify the UI file to load the window layout from.
ui_file: {{ file.dir }}/ui/mainwindow.ui
# Specify a stylesheet to use only for mainwindow.
stylesheet: null
# Set the window title from from the date in the vcp section above.
title: ( vcp.name ) ( vcp.version)

application:
kwargs:
# Specify the application wide stylesheet.
stylesheet: {{ file.dir }}/ui/style.qss
15 changes: 15 additions & 0 deletions video_tests/qtpyvcp_test/mainwindow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow

# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)

class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)

# add any custom methods here
def on_exitBtn_clicked(self):
self.app.quit()

Loading

0 comments on commit 91b8b6d

Please # to comment.