Difference between revisions of "Clipboard Transformations"

From OpenCircuits
Jump to navigation Jump to search
Line 33: Line 33:
 
The GUI names should match those below, but use a bit of caution.
 
The GUI names should match those below, but use a bit of caution.
  
== CAP ==
+
== Add *>url ==
 
+
* What:
 +
* Why: to save url's in command format for later use with *cmd button
 +
* Lines with a url have *>url pre-pended to the line.  This is the command indicatior for the *cmd button to go to a given url.
 +
* Lines without urls are left unaltered.
 +
  
 +
== Add *>shell ==
 +
* What:
 +
* Why:
  
 
== Alt Line Sort 0 ==
 
== Alt Line Sort 0 ==
  
 +
* What:
 
* Why: I use this to sort url and page titles captured from my browser, typically saved for links  
 
* Why: I use this to sort url and page titles captured from my browser, typically saved for links  
 
* Text is broken up into pairs of lines, blank lines being dropped.
 
* Text is broken up into pairs of lines, blank lines being dropped.
 
* The pair is sorted on the contents of the first line in the pair.
 
* The pair is sorted on the contents of the first line in the pair.
 
* The text is rebuilt with a blank line separating each pair.
 
* The text is rebuilt with a blank line separating each pair.
 +
 +
== CAP ==
 +
* What:
 +
* Why:
 +
 +
  
 
== Line Num ==
 
== Line Num ==
 
+
* What:
 +
* Why:
  
 
== No Blank Lines ==
 
== No Blank Lines ==
  
== Add *>url ==
 
* Why to save url's in command format for later use with *cmd button
 
* Lines with a url have *>url pre-pended to the line.  This is the command indicatior for the *cmd button to go to a given url.
 
* Lines without urls are left unaltered.
 
 
 
== Add *>shell ==
 
* Why
 
  
 
== No Trail Space ==
 
== No Trail Space ==
Line 63: Line 70:
 
* Why: Trailing white space is just a waste of space and may slow down code editing.
 
* Why: Trailing white space is just a waste of space and may slow down code editing.
  
== Tab > Space ==
 
  
* What: Rempve all tab characters changing them to spaces.
+
== No Trail Space ==
* Why: Python programmers tend to prefer spaces over tabs.  A mix of them can be confusing when editiong, and can cause Python programs that look correct to fail.
 
  
 +
* What: Remove all trailing white space.
 +
* Why: Trailing white space is just a waste of space and may slow down code editing.
  
  
Line 82: Line 89:
 
== Line Num ==
 
== Line Num ==
  
* What:
+
* What: Put sequential numbers in front of each non-blank lines
* Why:
+
* Why: Sometimes nice to have you lines numbered.
  
 
== No WS ==
 
== No WS ==
  
* What:
+
* What: Remove all white space.
 
* Why:
 
* Why:
  
 +
== Tab > Space ==
 +
 +
* What: Rempve all tab characters changing them to spaces.
 +
* Why: Python programmers tend to prefer spaces over tabs.  A mix of them can be confusing when editiong, and can cause Python programs that look correct to fail.
  
  

Revision as of 07:33, 12 March 2020

Root documentation of this application at: Python Smart ClipBoard This page is the documentation for the details of the Transformations.

General

The application deals only with unformatted text in the clipboard. Images.... are not processed. Formatted text is converted ( irreversibly ) to unformatted text unless the off radio button is depressed before the selection is "clipped". You can ususally return to the unformatted, untransformed version of the clipboard by pressing either <off> or <unformatted>. If you press an unintended button, just go back and press the intended one.


A transformation takes in some text, typically multi-lined and converts it to something else, also possibly multi-lined. The transformed text is placed in the system clipboard and displayed in the application GUI. Each time a transformation button is pressed the original text in the clipboard is transformed. To apply a new transformation to the result of the last transformation press the <Chain> button. Once Chain is pressed the original clipped text is gone.

Transformations Do What

You can tell what each transformation does by:

  • Hopefully each name is suggestive <CAP> capitalizes the text.
  • The GUI documentation gives a somewhat expanded explanation of each transformation ClipBoard GUI
  • Try them out, just do not "paste" results you do not like.
  • More documentation here ?
  • Read the code: cmd_processor.transform_{some suggestive name }


  • Some functions may remove blank lines.
  • Some functions may remove lines commented with #

General Rules

Most transformations ( and perhaps all in the future ) do some general processing:

  • Break the text into multiple lines using a variety of markers ( see Python splitlines ),
  • Delete trailing spaces on each line
  • Joins lines back using a standard line marker ( cmd_processor.line_join )

Individual Transformations

The GUI names should match those below, but use a bit of caution.

Add *>url

  • What:
  • Why: to save url's in command format for later use with *cmd button
  • Lines with a url have *>url pre-pended to the line. This is the command indicatior for the *cmd button to go to a given url.
  • Lines without urls are left unaltered.


Add *>shell

  • What:
  • Why:

Alt Line Sort 0

  • What:
  • Why: I use this to sort url and page titles captured from my browser, typically saved for links
  • Text is broken up into pairs of lines, blank lines being dropped.
  • The pair is sorted on the contents of the first line in the pair.
  • The text is rebuilt with a blank line separating each pair.

CAP

  • What:
  • Why:


Line Num

  • What:
  • Why:

No Blank Lines

No Trail Space

  • What: Remove all trailing white space.
  • Why: Trailing white space is just a waste of space and may slow down code editing.


No Trail Space

  • What: Remove all trailing white space.
  • Why: Trailing white space is just a waste of space and may slow down code editing.


Less WS

  • What: Remove multiple white space characters in a row replacing them with a single space.
  • Why:

Line Sort

  • What:
  • Why:

Line Num

  • What: Put sequential numbers in front of each non-blank lines
  • Why: Sometimes nice to have you lines numbered.

No WS

  • What: Remove all white space.
  • Why:

Tab > Space

  • What: Rempve all tab characters changing them to spaces.
  • Why: Python programmers tend to prefer spaces over tabs. A mix of them can be confusing when editiong, and can cause Python programs that look correct to fail.