File tree Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 10
10
values. ([ #11 ] ( https://github.com/davep/complexitty/issues/11 ) )
11
11
- Changed the display of the X/Y location so that the precision adapts to
12
12
the zoom level. ([ #14 ] ( https://github.com/davep/complexitty/issues/14 ) )
13
+ - Added ` CopyCommandLineToClipboard ` .
14
+ ([ #20 ] ( https://github.com/davep/complexitty/pull/20 ) )
13
15
14
16
## v0.2.0
15
17
Original file line number Diff line number Diff line change 11
11
SetColourToShadesOfGreen ,
12
12
SetColourToShadesOfRed ,
13
13
)
14
- from .main import Quit
14
+ from .main import CopyCommandLineToClipboard , Quit
15
15
from .navigation import (
16
16
GoMiddle ,
17
17
GoTo ,
42
42
##############################################################################
43
43
# Exports.
44
44
__all__ = [
45
+ "CopyCommandLineToClipboard" ,
45
46
"DecreaseMaximumIteration" ,
46
47
"DecreaseMultibrot" ,
47
48
"GreatlyDecreaseMaximumIteration" ,
Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ class Quit(Command):
14
14
SHOW_IN_FOOTER = True
15
15
16
16
17
+ ##############################################################################
18
+ class CopyCommandLineToClipboard (Command ):
19
+ """Copy the command line for the current view to the clipboard"""
20
+
21
+ BINDING_KEY = "c"
22
+
23
+
17
24
### main.py ends here
Original file line number Diff line number Diff line change 12
12
##############################################################################
13
13
# Local imports.
14
14
from ..commands import (
15
+ CopyCommandLineToClipboard ,
15
16
DecreaseMaximumIteration ,
16
17
DecreaseMultibrot ,
17
18
GoMiddle ,
@@ -55,6 +56,7 @@ def commands(self) -> CommandHits:
55
56
Yields:
56
57
The commands for the command palette.
57
58
"""
59
+ yield CopyCommandLineToClipboard ()
58
60
yield ChangeTheme ()
59
61
yield DecreaseMaximumIteration ()
60
62
yield DecreaseMultibrot ()
Original file line number Diff line number Diff line change 22
22
##############################################################################
23
23
# Local imports.
24
24
from ..commands import (
25
+ CopyCommandLineToClipboard ,
25
26
DecreaseMaximumIteration ,
26
27
DecreaseMultibrot ,
27
28
GoMiddle ,
@@ -75,6 +76,7 @@ class Main(EnhancedScreen[None]):
75
76
ChangeTheme ,
76
77
Quit ,
77
78
# Everything else.
79
+ CopyCommandLineToClipboard ,
78
80
DecreaseMaximumIteration ,
79
81
DecreaseMultibrot ,
80
82
GoMiddle ,
@@ -253,5 +255,20 @@ async def action_go_to_command(self) -> None:
253
255
severity = "error" ,
254
256
)
255
257
258
+ def action_copy_command_line_to_clipboard_command (self ) -> None :
259
+ """Copy the current view as a command, to the clipboard."""
260
+ plot = self .query_one (Mandelbrot )
261
+ command = (
262
+ f"complexitty "
263
+ f"--x-position={ plot .x_position } "
264
+ f"--y-position={ plot .y_position } "
265
+ f"--zoom={ plot .zoom } "
266
+ f"--max-iteration={ plot .max_iteration } "
267
+ f"--multibrot={ plot .multibrot } "
268
+ f"--colour-map={ plot .colour_map .__name__ } "
269
+ )
270
+ self .app .copy_to_clipboard (command )
271
+ self .notify (command , title = "Copied" )
272
+
256
273
257
274
### main.py ends here
You can’t perform that action at this time.
0 commit comments