Clipboard Transformations

From OpenCircuits
Jump to navigation Jump to search

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.

CAP

Alt Line Sort 0

  • 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.

Line Num

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

  • What: Remove all trailing white space.
  • 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.
  • 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.


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:
  • Why:

No WS

  • What:
  • Why: