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 1010 values. ([ #11 ] ( https://github.com/davep/complexitty/issues/11 ) )
1111- Changed the display of the X/Y location so that the precision adapts to
1212 the zoom level. ([ #14 ] ( https://github.com/davep/complexitty/issues/14 ) )
13+ - Added ` CopyCommandLineToClipboard ` .
14+ ([ #20 ] ( https://github.com/davep/complexitty/pull/20 ) )
1315
1416## v0.2.0
1517
Original file line number Diff line number Diff line change 1111 SetColourToShadesOfGreen ,
1212 SetColourToShadesOfRed ,
1313)
14- from .main import Quit
14+ from .main import CopyCommandLineToClipboard , Quit
1515from .navigation import (
1616 GoMiddle ,
1717 GoTo ,
4242##############################################################################
4343# Exports.
4444__all__ = [
45+ "CopyCommandLineToClipboard" ,
4546 "DecreaseMaximumIteration" ,
4647 "DecreaseMultibrot" ,
4748 "GreatlyDecreaseMaximumIteration" ,
Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ class Quit(Command):
1414 SHOW_IN_FOOTER = True
1515
1616
17+ ##############################################################################
18+ class CopyCommandLineToClipboard (Command ):
19+ """Copy the command line for the current view to the clipboard"""
20+
21+ BINDING_KEY = "c"
22+
23+
1724### main.py ends here
Original file line number Diff line number Diff line change 1212##############################################################################
1313# Local imports.
1414from ..commands import (
15+ CopyCommandLineToClipboard ,
1516 DecreaseMaximumIteration ,
1617 DecreaseMultibrot ,
1718 GoMiddle ,
@@ -55,6 +56,7 @@ def commands(self) -> CommandHits:
5556 Yields:
5657 The commands for the command palette.
5758 """
59+ yield CopyCommandLineToClipboard ()
5860 yield ChangeTheme ()
5961 yield DecreaseMaximumIteration ()
6062 yield DecreaseMultibrot ()
Original file line number Diff line number Diff line change 2222##############################################################################
2323# Local imports.
2424from ..commands import (
25+ CopyCommandLineToClipboard ,
2526 DecreaseMaximumIteration ,
2627 DecreaseMultibrot ,
2728 GoMiddle ,
@@ -75,6 +76,7 @@ class Main(EnhancedScreen[None]):
7576 ChangeTheme ,
7677 Quit ,
7778 # Everything else.
79+ CopyCommandLineToClipboard ,
7880 DecreaseMaximumIteration ,
7981 DecreaseMultibrot ,
8082 GoMiddle ,
@@ -253,5 +255,20 @@ async def action_go_to_command(self) -> None:
253255 severity = "error" ,
254256 )
255257
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+
256273
257274### main.py ends here
You can’t perform that action at this time.
0 commit comments