Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:FCS-analysis/PyCorrFit
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 25, 2019
2 parents ed965af + 550fb2f commit 7e6186d
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: paulmueller
liberapay: paulmueller
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.1.7
- docs: add sponsor links to contribute section
- docs: add gallery with all images in docs/gallery
1.1.6
- fix: improve support for Confocor FCS file format
(see discussion in #37)
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ test_script:
after_test:
# If tests are successful, create a whl package for the project.
- "appveyor-retry pip install twine wheel"
# If tests are successful, create a whl package for the project.
- "python setup.py bdist_wheel"
- "python setup.py sdist"
- ps: "ls dist"
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'github_changelog',
'simple_gallery',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -119,7 +120,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
63 changes: 63 additions & 0 deletions docs/extensions/simple_gallery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Show all images in the "gallery" folder
Usage:
.. simple_gallery::
:dir: gallery
where "gallery" is relative to the folder containing conf.py.
Changelog:
0.1 (2019-10-24)
- initial release
"""
import pathlib

from docutils.statemachine import ViewList
from docutils.parsers.rst import Directive, directives
from sphinx.util.nodes import nested_parse_with_titles
from docutils import nodes


class SimpleGalleryDirective(Directive):
required_arguments = 0
optional_arguments = 1
final_argument_whitespace = True

option_spec = {
'dir': directives.unchanged,
}

def get_files(self):
"""This will return a list of files"""
root = pathlib.Path(__file__).parent.parent
gpath = root / self.options["dir"]
files = []
for ff in gpath.glob("*"):
if ff.suffix in [".png", "*.jpg"]:
files.append(ff.relative_to(root))
return files

def run(self):
rst = []
files = self.get_files()

for ff in files:
rst.append(".. image:: {}".format(ff))
rst.append(" :target: _images/{}".format(ff.name))
rst.append(" :scale: 25%")
rst.append(" :align: left")
rst.append("")

vl = ViewList(rst, "fakefile.rst")
# Create a node.
node = nodes.section()
node.document = self.state.document
# Parse the rst.
nested_parse_with_titles(self.state, vl, node)
return node.children


def setup(app):
app.add_directive('simple_gallery', SimpleGalleryDirective)
return {'version': '0.1'} # identifies the version of our extension
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mock
sphinx>=1.6.4
sphinxcontrib.bibtex
sphinx_rtd_theme
7 changes: 6 additions & 1 deletion docs/sec_contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ PyCorrFit) in numerous ways:
familiar with reStrucuredText or LaTeX, you might be able to help
out with the online documentation.

5. Please cite: Müller et al. Bioinformatics 30(17): 2532–2533, 2014
5. Please cite: Müller et al. Bioinformatics 30(17): 2532–2533, 2014,
`DOI:10.1093/bioinformatics/btu328
<https://dx.doi.org/10.1093/bioinformatics/btu328>`_

6. Sponsor me on `GitHub <https://github.com/sponsors/paulmueller>`_
or donate via `Liberapay <https://liberapay.com/paulmueller>`_.

If you are planning to contribute to PyCorrFit, please contact me via
the PyCorrFit issue page on GitHub such that we may coordinate a pull
Expand Down
5 changes: 2 additions & 3 deletions docs/sec_gallery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
Gallery
=======

TODO:
- Automatically insert all images from the gallery folder.
- Add new screenshots.
.. simple_gallery::
:dir: gallery
81 changes: 81 additions & 0 deletions pycorrfit/gui/contribute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import wx
from wx.lib import sized_controls
import wx.lib.agw.hyperlink as hl


class ContributeDialog(sized_controls.SizedDialog):

def __init__(self, *args, **kwargs):
super(ContributeDialog, self).__init__(title="Contribute to PyCorrFit",
*args, **kwargs)
pane = self.GetContentsPane()

pane_btns = sized_controls.SizedPanel(pane)
pane_btns.SetSizerType('vertical')
pane_btns.SetSizerProps(align="center")

wx.StaticText(pane_btns, label=contribute_text)
wx.StaticText(pane_btns, label="\nLinks:")
for ii, link in enumerate(contribute_links):
hl.HyperLinkCtrl(pane_btns,
-1,
"[{}] {}".format(ii+1, link),
URL=link)
wx.StaticText(pane_btns, label="\n")

button_ok = wx.Button(pane_btns, label='OK')
button_ok.Bind(wx.EVT_BUTTON, self.on_button)
button_ok.SetFocus()
button_ok.SetSizerProps(expand=True)

self.Fit()

def on_button(self, event):
if self.IsModal():
self.EndModal(event.EventObject.Id)
else:
self.Close()


contribute_text = """
PyCorrFit has no funding and a vanishingly small developer community.
My personal objective is to keep PyCorrFit operational on Linux and
Windows which is currently limited by the free time I have available.
An active community is very important for an open source project such
as PyCorrFit. You can help this community grow (and thus help improve
PyCorrFit) in numerous ways:
1. \tTell your colleagues and peers about PyCorrFit. One of them
\tmight be able to contribute to the project.
2. \tIf you need a new feature in PyCorrFit, publicly announce a
\tbounty for its implementation.
3. \tIf your research heavily relies on FCS, please consider
\tdiverting some of your resources to the development
\tof PyCorrFit.
4. \tYou don't have to be a Python programmer to contribute. If
\tyou are familiar with reStrucuredText or LaTeX, you might
\tbe able to help out with the online documentation.
5. \tPlease cite: Müller et al. Bioinformatics 30(17): 2532–2533,
\t2014 [1].
6. \tSponsor me on GitHub [2] or donate via Liberapay [3].
If you are planning to contribute to PyCorrFit, please contact me via
the PyCorrFit issue page on GitHub such that we may coordinate a pull
request.
Thank you!
Paul Müller (October 2019)
"""


contribute_links = [
"https://dx.doi.org/10.1093/bioinformatics/btu328",
"https://github.com/sponsors/paulmueller",
"https://liberapay.com/paulmueller",
]
38 changes: 2 additions & 36 deletions pycorrfit/gui/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def SoftwareUsed():
"\n - wxPython "+wx.__version__
# Other software
text += "\n\nOther software:" +\
"\n - FCS_point_correlator ({})".format(read_pt3_scripts.version) +\
"\n - FCS_point_correlator ({})".format(
read_pt3_scripts.version) +\
"\n PicoQuant file format for Python by Dominic Waithe"
if hasattr(sys, 'frozen'):
pyinst = "\n\nThis executable has been created using PyInstaller."
Expand All @@ -114,41 +115,6 @@ def SoftwareUsed():
return text


support = """
PyCorrFit has no funding and a vanishingly small developer community.
My personal objective is to keep PyCorrFit operational on Linux and
Windows which is currently limited by the free time I have available.
An active community is very important for an open source project such
as PyCorrFit. You can help this community grow (and thus help improve
PyCorrFit) in numerous ways:
1. \tTell your colleagues and peers about PyCorrFit. One of them might
\tbe able to contribute to the project.
2. \tIf you need a new feature in PyCorrFit, publicly announce a bounty
\tfor its implementation.
3. \tIf your research heavily relies on FCS, please consider diverting
\tsome of your resources to the development of PyCorrFit.
4. \tYou don't have to be a Python programmer to contribute. If you are
\tfamiliar with reStrucuredText or LaTeX, you might be able to help
\tout with the online documentation.
5. \tPlease cite: Müller et al. Bioinformatics 30(17): 2532–2533, 2014
If you are planning to contribute to PyCorrFit, please contact me via
the PyCorrFit issue page on GitHub such that we may coordinate a pull
request.
Thank you!
Paul Müller (May 2018)
"""


# Standard homepage
HomePage = "http://pycorrfit.craban.de/"
# Changelog filename
Expand Down
19 changes: 10 additions & 9 deletions pycorrfit/gui/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


# PyCorrFit modules
from . import contribute
from . import doc
from . import edclasses
from . import misc
Expand Down Expand Up @@ -189,7 +190,7 @@ def __init__(self, parent, anid, version):

# Display support dialog
if hasattr(sys, "frozen"):
self.OnSupport()
self.OnContribute()

def add_fitting_tab(self, event=None, modelid=None, counter=None,
select=False):
Expand Down Expand Up @@ -369,8 +370,8 @@ def MakeMenu(self):
menuentry = submenu.Append(model[0], model[1], model[2])
self.Bind(wx.EVT_MENU, self.add_fitting_tab, menuentry)
# help menu
menuSupport = helpmenu.Append(wx.ID_ANY, "&Support",
"How to (get) support (for) PyCorrFit")
menuContribute = helpmenu.Append(wx.ID_ANY, "&Contribute",
"How to contribute to PyCorrFit")
menuDocu = helpmenu.Append(wx.ID_ANY, "&Documentation",
"PyCorrFit documentation")
menuWiki = helpmenu.Append(wx.ID_ANY, "&Wiki",
Expand Down Expand Up @@ -418,7 +419,7 @@ def MakeMenu(self):
self.Bind(wx.EVT_MENU, self.OnLatexCheck, self.MenuUseLatex)
# Help
self.Bind(wx.EVT_MENU, self.OnSoftware, menuSoftw)
self.Bind(wx.EVT_MENU, self.OnSupport, menuSupport)
self.Bind(wx.EVT_MENU, self.OnContribute, menuContribute)
self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
self.Bind(wx.EVT_MENU, self.OnUpdate, menuUpdate)
self.Bind(wx.EVT_MENU, self.OnDocumentation, menuDocu)
Expand Down Expand Up @@ -631,6 +632,11 @@ def OnCommSession(self, e=None):
# Close Dialog
self.EditCommentDlg.OnClose()

def OnContribute(self, event=None):
# Show contribute dialog
dlg = contribute.ContributeDialog(self)
dlg.ShowModal()

def OnDeletePage(self, event=None):
"""
This method is based on the flatnotebook demo
Expand Down Expand Up @@ -1683,11 +1689,6 @@ def OnSoftware(self, event=None):
text = doc.SoftwareUsed()
wx.MessageBox(text, 'Software', wx.OK | wx.ICON_INFORMATION)

def OnSupport(self, event=None):
# Show About Information
text = doc.support
wx.MessageBox(text, 'Support PyCorrFit', wx.OK | wx.ICON_INFORMATION)

def OnTool(self, event):
eid = event.GetId()
try:
Expand Down

0 comments on commit 7e6186d

Please sign in to comment.