Skip to content

Commit 666e303

Browse files
authored
Merge pull request #1112 from saulpw/develop
v2.6
2 parents 2339650 + 1a70d29 commit 666e303

File tree

154 files changed

+49783
-1075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+49783
-1075
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ visidata.egg-info/
1111
*_build
1212
tags
1313
/tests/log/
14+
# Mac files
15+
.DS_Store

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
# VisiData version history
22

3+
# 2.6 (2021-09-19)
4+
5+
## Major feature
6+
7+
- [menu] new hierarchical menu system
8+
- `Alt+F`, `Alt+E`, etc to open submenus (`Alt+` underlined capital letter in toplevel menu)
9+
- `Ctrl+H` to activate Help menu (manpage now at `gCtrl+H`)
10+
- `q` or `Esc` to exit menu
11+
- Enter to expand submenu item or execute command
12+
- or left mouse click to activate and navigate menu
13+
- only show commands available on current sheet
14+
- sheet-specific commands highlighted with `options.color_menu_spec`
15+
- new options:
16+
- `disp_menu`: display menu if inactive (default True). Can still activate menu with Ctrl+H/Alt+F
17+
- `disp_menu_keys`: whether to display shortcuts inline (default True)
18+
- `disp_menu_fmt`: upper right display on menu bar (like `disp_status_fmt`/`disp_rstatus_fmt`)
19+
- theme colors: `color_menu` `color_menu_active` `color_menu_spec` `color_menu_help`
20+
- theme chars: `disp_menu_boxchars` `disp_menu_more` `disp_menu_push` `disp_menu_input` `disp_menu_fmt`
21+
22+
## Interface changes
23+
24+
- [expand-col] only expand to one level
25+
- [slide] remove slide row/col with mouse
26+
- [macos] add bindings for Option+key to Alt+key
27+
- [modified] limit use of sheet protection (thanks @geekscrapy #1037)
28+
- [python] rebind g^X to new import-python command (what exec-python was mostly used for)
29+
- [npy] add `npy_allow_pickle` option (default False)
30+
- [join] rename join-sheets on IndexSheet to join-selected; bind both g& and & to join-selected
31+
- [loaders pandas] add error message for unpickling non-dataframes
32+
- [join] fail if no key columns on any sheet (thanks @geekscrapy #1061)
33+
- [loaders xlsx] enable access to cell metadata (thanks @hoclun-rigsep #1088)
34+
- many performance, progress bar, and UI responsiveness improvements
35+
36+
## Bugfixes
37+
38+
- [cli] issue warning if +sheet-position not found (thanks @geekscrapy #1046)
39+
- [clipboard] do not copy newline for syscopy-cell (thanks @geekscrapy #1064)
40+
- [column] detect existing column by row key instead of column name (thanks @geekscrapy #1058)
41+
- [color] set `color_current_row` to the same precedence as `color_current_column` (thanks @frosenrantz #1100)
42+
- [command] do not fail/abort on unknown command
43+
- [draw] Sort indicator on top of More indicator (thanks @geekscrapy #1071)
44+
- [join] fix multiple extend (thanks @cwarden)
45+
- [join] allow extended columns to be modified (thanks @cwarden)
46+
- [join] fix for rowdefs without bool (like pandas)
47+
- [loaders dirsheet] continue after exception in copyfile
48+
- [loaders fixed] fix fixed-format saver
49+
- [loaders fixed] save uses `global options.encoding` (thanks @geekscrapy #1060)
50+
- [loaders mysql] do not stop loading on first error (thanks @SuRaMoN #1085)
51+
- [loaders pandas] fix column rename
52+
- [loaders sqlite] save based on column names, not position
53+
- [loaders sqlite] allow changing value of cells that were NULL (thanks @mattenklicker #1052)
54+
- [loaders sqlite] add message on not currently supporting WITHOUT ROWID (thanks @stephancb #1111)
55+
- [multisave] fix breaking typo
56+
- [open_txt] load new blank sheet for 0 byte files (thanks @geekscrapy #1047)
57+
- [save] do not set a default for `options.save_filetype` (thanks @frosencrantz #1072)
58+
- [split-pane mouse] activate pane on click (thanks @frosencrantz #954)
59+
- [unfurl] handle unfurling exceptions (close #1053)
60+
- [quitguard] confirm quit when set on a specific sheet even if not precious or modified
61+
- [yaml] Fix yaml loader traces on no attribute `_colnames` (thanks @frosencrantz #1104)
62+
- [visidatarc] catch all visidatarc exceptions upon load
63+
364
# v2.5 (2021-07-08)
465

566
- [social] #visidata has moved off of freenode to libera.chat

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
don't be a dick
1+
Please don't be a dick

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# VisiData v2.5 [![twitter @VisiData][1.1]][1] [![CircleCI](https://circleci.com/gh/saulpw/visidata/tree/stable.svg?style=svg)](https://circleci.com/gh/saulpw/visidata/tree/stable) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/saulpw/visidata)
2+
# VisiData v2.6 [![twitter @VisiData][1.1]][1] [![CircleCI](https://circleci.com/gh/saulpw/visidata/tree/stable.svg?style=svg)](https://circleci.com/gh/saulpw/visidata/tree/stable) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/saulpw/visidata)
33

44
A terminal interface for exploring and arranging tabular data.
55

bin/viewtsv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from visidata import Sheet, ColumnItem, asyncthread, options
77

8-
9-
def open_tsv(p):
8+
@VisiData.api
9+
def open_tsv(vd, p):
1010
return MinimalTsvSheet(p.name, source=p)
1111

1212

dev/ROADMAP

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- [options] option enums
66
- [options] user-defined option aliases
77
- [splitpane] File preview in directory view
8-
- [defermods] 'modified since last save' indicator on status bar
8+
+ [defermods] 'modified since last save' indicator on status bar
99
- [scroll cell] zh/zl Left hand side of a cell with content hidden doesn't show ellipsis #751
1010

1111
2. Persistence

dev/api.md

Lines changed: 0 additions & 162 deletions
This file was deleted.

docs/api/extensible.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ must come before ``@classmethod``.
7979

8080
This acts just like the ``@property`` decorator, if it were defined inline to the class.
8181

82-
.. autofunction:: visidata.Extensible.cached_property
82+
.. autofunction:: visidata.Extensible.lazy_property
8383

8484
This works like ``@property``, except it only computes the value on first access, and then caches it for every subsequent usage.
8585

8686
.. note::
8787

8888
Because of how Python instantiates classes, extensions monkey-patched into a class are not also added to already-instantiated objects.
89-
So global sheets defined by a plugin should be added to the VisiData object with ``cached_property``.
89+
So global sheets defined by a plugin should be added to the VisiData object as a ``@VisiData.lazy_property``.
9090
This way, they are not created until their first use, which allows them to take advantage of Sheet extensions that were loaded after the plugin.
9191

9292

@@ -123,13 +123,26 @@ If *copy* is ``True``, then a copy is made of the member for the new instance.
123123

124124
.. autofunction:: visidata.vd.global_api
125125

126-
When a function is defined in a .py module in visidata, it is available as a global function in that module.
126+
All features (and plugins) should expose functions and classes to plugins in one of these ways:
127127

128-
VisiData does an effective ``from X import *`` for each plugin and modular feature, so that its package (or global) scope gets all of the exposed symbols. See :ref:`getGlobals() and addGlobals() <other-commands>`.
128+
1. with `@VisiData.api` (or @Sheet.api): for most methods
129129

130-
Everything in a .py module is exported automatically, unless there is an ``__all__`` with a list of the names of the functions that should be exported, and it will export only those.
130+
These can be used in an execstr as though they were global (attributes on `vd` and `sheet` are both implicitly in scope in an execstr).
131131

132-
Each VisiData feature and plugin should include an ``__all__``, either empty or with an explicit list of function names to be available to :ref:`commands <commands>` and `Expressions <>`__.
132+
Outside of an execstr, use `vd.funcname(...)` (or `sheet.funcname(...)`).
133+
134+
Note that classes can be annotated with `@VisiData.api` also.
135+
136+
2. with `addGlobals({"funcname": funcname})`: for classes and methods internal to VisiData
137+
138+
These can be used via direct import:
139+
140+
`from visidata import SomeInternalClass`
141+
`from plugins.myplugin import HelperClass`
142+
143+
This is acceptable for commonly-used classes.
144+
145+
See :ref:`getGlobals() and addGlobals() <other-commands>`.
133146

134147
What to extend: ``Sheet``, ``Column``, ``VisiData``, or globals?
135148
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/api/interface.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,34 @@ Examples
151151
# colors cells
152152
CellColorizer(3, None, lambda s,c,r,v: v.value if r and c in s.columns[1:3] and r.name.startswith('color_') else None)
153153
]
154+
155+
Menu System
156+
===========
157+
158+
Features and plugins can add commands to the hierarchical menu system (new in v2.6).
159+
160+
.. autofunction:: visidata.vd.runMenu
161+
.. autofunction:: visidata.vd.addMenu
162+
.. autofunction:: visidata.vd.addMenuItem
163+
164+
.. autoclass:: visidata.Menu
165+
.. data:: visidata.vd.menus
166+
167+
`vd.menus` contains the hierarchical list all Menu() objects, for exploration.
168+
169+
Examples
170+
^^^^^^^^
171+
172+
::
173+
174+
# add a single command to an existing menusubmenu with multiple commands
175+
vd.addMenuItem('Column', 'Add column', 'enhance', 'enhance-col')
176+
177+
# add a submenu with multiple commands
178+
vd.addMenu(Menu('Data', Menu('Enhance',
179+
Menu('this column', 'enhance-col'),
180+
Menu('all columns', 'enhance-cols'),
181+
)))
182+
183+
# activate menu and navigate to Data»Enhance
184+
vd.runMenu('Data', 'Enhance')

docs/api/loaders.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ This is a completely functional loader for the ``sas7bdat`` (SAS dataset file) f
239239

240240
from visidata import Sheet, ItemColumn, Progress
241241

242-
def open_sas7bdat(p):
242+
@VisiData.api
243+
def open_sas7bdat(vd, p):
243244
return SasSheet(p.name, source=p)
244245

245246
class SasSheet(Sheet):

0 commit comments

Comments
 (0)