Skip to content

Commit

Permalink
Merge pull request #166 from djhoese/remove-mpl-scripts
Browse files Browse the repository at this point in the history
Change matplotlib backend to GTk3Agg for POSIX
  • Loading branch information
djhoese authored Sep 21, 2023
2 parents f5646f3 + 301c0b9 commit 689089d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
--index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple/ \
--trusted-host pypi.anaconda.org \
--no-deps --pre --upgrade \
matplotlib \
numpy;
LD_PRELOAD=$(python -c "import sys; print(sys.prefix)")/lib/libstdc++.so
echo "LD_PRELOAD=${LD_PRELOAD}" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ LSM files, it is as fast as libtiff.py by using numpy.
# Script usage examples #

```
$ libtiff.info -i result_0.tif --no-gui
$ libtiff.info -i result_0.tif
IFDEntry(tag=ImageWidth, value=512, count=1, offset=None)
IFDEntry(tag=ImageLength, value=512, count=1, offset=None)
IFDEntry(tag=BitsPerSample, value=32, count=1, offset=None)
Expand All @@ -92,7 +92,7 @@ strip_length : 1048576
```

```
$ libtiff.info --no-gui -i psf_1024_z5_airy1_set1.lsm
$ libtiff.info -i psf_1024_z5_airy1_set1.lsm
IFDEntry(tag=NewSubfileType, value=0, count=1, offset=None)
IFDEntry(tag=ImageWidth, value=1024, count=1, offset=None)
IFDEntry(tag=ImageLength, value=1024, count=1, offset=None)
Expand Down
29 changes: 3 additions & 26 deletions libtiff/script_options.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@


__all__ = ['set_formatter', 'set_info_options', 'set_convert_options']

import os
from optparse import NO_DEFAULT
from optparse import TitledHelpFormatter

try:
import wx # noqa: F401
have_wx = True
except ImportError:
have_wx = False


class MyHelpFormatter(TitledHelpFormatter):

Expand Down Expand Up @@ -60,20 +51,13 @@ def set_formatter(parser):

def set_convert_options(parser):
set_formatter(parser)
if os.name == 'posix':
try:
import matplotlib
matplotlib.use('GTkAgg')
parser.run_methods = ['subcommand']
except ImportError:
pass
parser.set_usage('%prog [options] -i INPUTPATH [-o OUTPUTPATH]')
parser.set_description('Convert INPUTPATH to OUTPUTPATH.')
parser.add_option('--input-path', '-i',
type='file' if have_wx else str, metavar='INPUTPATH',
type=str, metavar='INPUTPATH',
help='Specify INPUTPATH.')
parser.add_option('--output-path', '-o',
type='file' if have_wx else str, metavar='OUTPUTPATH',
type=str, metavar='OUTPUTPATH',
help='Specify OUTPUTPATH.')
parser.add_option('--compression',
type='choice', default='none',
Expand All @@ -89,17 +73,10 @@ def set_convert_options(parser):

def set_info_options(parser):
set_formatter(parser)
if os.name == 'posix':
try:
import matplotlib
matplotlib.use('GTkAgg')
parser.run_methods = ['subcommand']
except ImportError:
pass
parser.set_usage('%prog [options] -i INPUTPATH')
parser.set_description('Show INPUTPATHs information.')
parser.add_option('--input-path', '-i',
type='file' if have_wx else str, metavar='INPUTPATH',
type=str, metavar='INPUTPATH',
help='Specify INPUTPATH.')
parser.add_option('--memory-usage',
action='store_true', default=False,
Expand Down

0 comments on commit 689089d

Please sign in to comment.