Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v4' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Apr 4, 2019
2 parents a85ac22 + b4a83de commit e672772
Show file tree
Hide file tree
Showing 65 changed files with 5,023 additions and 1,083 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "orquestra"]
path = orquestra
url = https://github.com/UmSenhorQualquer/orquestra.git
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pyforms **Web** is a software layer, part of the Pyforms main library. This laye
<!-- Posicione esta tag onde você deseja que o widget apareça. -->
<div class="g-follow" data-annotation="bubble" data-height="24" data-rel="publisher"></div>

Pyforms is a Python 3 cross-enviroment framework that aims the boost the developement productivity. The library provides an API in Python to develop applications that can be executed in Windows GUI mode, Web mode, or in Terminal mode.
Pyforms is a Python 3 cross-enviroment framework that aims the boost the development productivity. The library provides an API in Python to develop applications that can be executed in Windows GUI mode, Web mode, or in Terminal mode.

[More @ ![Diagram](https://raw.githubusercontent.com/UmSenhorQualquer/pyforms-web/v4/docs/source/_static/imgs/rtd.png)](https://pyforms.readthedocs.io)

Expand All @@ -42,7 +42,7 @@ With GUI applications, users would be able to set the parameters using a GUI int

After looking into the several python options for GUI interfaces, PyQt was the one that seemed the best tool for a fast development with the QtDesigner, but after a while developing in Qt, switching between the designer and the python IDE was becoming too costly in terms of time because the interfaces were constantly evolving.

Being a Django developer, I did get inspiration on it for this framework. In the [Django](https://www.djangoproject.com/) Models we just need to define the type of variables and their disposition in the form (in ModelAdmin) to generate a HTML form for data edition.
Being a Django developer, I did get inspiration on it for this framework. In the [Django](https://www.djangoproject.com/) Models we just need to define the type of variables and their disposition in the form (in ModelAdminWidget) to generate a HTML form for data edition.
For the GUIs that I wanted to build in my python scripts, I would like to have the same simplicity, so I could focus on the algorithms and not on GUIs developing.


Expand Down Expand Up @@ -81,7 +81,7 @@ class ComputerVisionAlgorithm(BaseWidget):
self._runbutton = ControlButton('Run')

#Define the function that will be called when a file is selected
self._videofile.changed = self.__videoFileSelectionEvent
self._videofile.changed_event = self.__videoFileSelectionEvent
#Define the event that will be called when the run button is processed
self._runbutton.value = self.__runEvent
#Define the event called before showing the image in the player
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/imgs/controls/linechart.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions docs/source/api-reference/python/controls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ControlBase
ControlAutoComplete
----------------------------

.. image:: /_static/imgs/controls/autocomplete.png

.. autoclass:: pyforms_web.controls.control_autocomplete.ControlAutoComplete
:members:
:undoc-members:
Expand Down Expand Up @@ -68,6 +70,8 @@ ControlCalendar
:show-inheritance:
:exclude-members: init_form, serialize, deserialize

----------------------------

ControlCheckBox
----------------------------

Expand All @@ -82,6 +86,29 @@ ControlCheckBox

----------------------------

ControlCheckBoxList
----------------------------

.. autoclass:: pyforms_web.controls.control_checkboxlist.ControlCheckBoxList
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize

----------------------------

ControlCheckBoxListQuery
----------------------------

.. autoclass:: pyforms_web.controls.control_checkboxlistquery.ControlCheckBoxListQuery
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize

----------------------------


ControlCombo
----------------------------

Expand Down Expand Up @@ -272,6 +299,35 @@ ControlLabel
:show-inheritance:
:exclude-members: init_form, serialize, deserialize

----------------------------

ControlLineChart
----------------------------

.. image:: /_static/imgs/controls/linechart.png
:align: center


.. autoclass:: pyforms_web.controls.control_linechart.ControlLineChart
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize



----------------------------


ControlList
----------------------------

.. autoclass:: pyforms_web.controls.control_list.ControlList
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize


----------------------------

Expand Down Expand Up @@ -327,6 +383,19 @@ ControlPassword

----------------------------



ControlPieChart
----------------------------

.. autoclass:: pyforms_web.controls.control_piechart.ControlPieChart
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize

----------------------------

ControlPlayer
----------------------------

Expand Down
67 changes: 66 additions & 1 deletion docs/source/getting-started/db-apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,69 @@ Use the ModelViewFormWidget widget to create a view only form.
)
]
...
...
Object access permissions
______________________________________

It is possible to restrict the objects a user has access in the widgets above using the Models Queryset manager.
The idea here is to define the access rules in the Model side, instead of defining the rules in the Visualization side. These way the Model can be ported from application to application maintaining the access rules.

Example:

.. code:: python
from django.db import models
class OrderQuerySet(models.QuerySet):
"""
ORDER QUERYSET MANAGER DEFINITION
"""
def list_permissions(self, user):
"""
The function filters the queryset to return only the objects the user has permissions to list.
"""
...
return self
def has_add_permissions(self, user):
"""
The function returns a Boolean indicating if the user can add or not a new object.
"""
...
return True
def has_view_permissions(self, user):
"""
The function returns a boolean indicating if the user has view permissions to the current queryset.
"""
...
return self
def has_update_permissions(self, user):
"""
The function filters the queryset to return only the objects the user has permissions to update.
"""
...
return self
def has_remove_permissions(self, user):
"""
The function filters the queryset to return only the objects the user has permissions to remove.
"""
...
return self
class Order(models.Model):
"""
MODEL DEFINITION
"""
...
objects = OrderQuerySet.as_manager()
4 changes: 2 additions & 2 deletions docs/source/getting-started/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Edit the django project **settings.py** file to include the next configurations.
INSTALLED_APPS = [
'orquestra',
'pyforms_web.web'
'pyforms_web.web',
'jfu',
'sorl.thumbnail',
...
Expand Down Expand Up @@ -65,7 +65,7 @@ Edit the django project **urls.py** file to include the next urls configurations
Create a pyforms settings file
================================

In the django project root folder (same folder of the manage.py file) create the loca_settings.py file with the next content.
In the django project root folder (same folder of the manage.py file) create the local_settings.py file with the next content.

.. code:: python
Expand Down
10 changes: 9 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pyforms Web documentation!

**Pyforms Web** is Python 3 framework to create single-page web applications.

The framework aims the boost the developement productivity by providing an API in Python that generates HTML Forms amd manages all the client\server forms communications.
The framework aims the boost the development productivity by providing an API in Python that generates HTML Forms amd manages all the client\server forms communications.

Developers do not require to write any HTML or Javascript code, all the code is done in Python 3.

Expand Down Expand Up @@ -97,6 +97,14 @@ The next code produces the next web application.
api-reference/python/index
api-reference/javascript/index

.. toctree::
:maxdepth: 4
:caption: More docs

Pyforms <https://pyforms.readthedocs.io>
Pyforms-GUI <https://pyforms-gui.readthedocs.io>
Pyforms-TERMINAL <https://pyforms-terminal.readthedocs.io>

Indices and tables
==================

Expand Down
1 change: 1 addition & 0 deletions orquestra
Submodule orquestra added at 759662
4 changes: 0 additions & 4 deletions pyforms/basewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@

from pyforms_web.basewidget import BaseWidget
from pyforms_web.organizers import no_columns, segment

from pyforms_web.modeladmin import ModelAdmin
from pyforms_web.modeladmin import ViewFormAdmin
from pyforms_web.modeladmin import EditFormAdmin
11 changes: 10 additions & 1 deletion pyforms_web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@
__email__ = "ricardojvr@gmail.com"
__status__ = "Development"

from confapp import conf; conf += 'pyforms_web.settings'

from confapp import conf;
conf += 'pyforms_web.settings'

#force the load of the local settings if exists
try:
import local_settings
conf += local_settings
except:
pass
2 changes: 2 additions & 0 deletions pyforms_web/allcontrols.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .controls.control_boundingslider import ControlBoundingSlider
from .controls.control_breadcrumb import ControlBreadcrumb
from .controls.control_button import ControlButton
from .controls.control_barschart import ControlBarsChart
from .controls.control_calendar import ControlCalendar
from .controls.control_checkbox import ControlCheckBox
from .controls.control_checkboxlist import ControlCheckBoxList
Expand All @@ -21,6 +22,7 @@
from .controls.control_integer import ControlInteger
from .controls.control_itemslist import ControlItemsList
from .controls.control_label import ControlLabel
from .controls.control_linechart import ControlLineChart
from .controls.control_simplelabel import ControlSimpleLabel
from .controls.control_list import ControlList
from .controls.control_menu import ControlMenu
Expand Down

0 comments on commit e672772

Please sign in to comment.