Skip to content

Commit

Permalink
Merge pull request #51 from cmang/dev
Browse files Browse the repository at this point in the history
Relase 0.26.0 Merge from dev
  • Loading branch information
cmang authored Mar 15, 2024
2 parents 21c8715 + dd88fc6 commit 11f73d1
Show file tree
Hide file tree
Showing 14 changed files with 582 additions and 111 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ FROM python:3.12-alpine
WORKDIR /durdraw
COPY . .
RUN pip install --upgrade .
RUN ./installconf.sh
#RUN ./installconf.sh
ENV TERM=xterm-256color
ENTRYPOINT ["durdraw"]
41 changes: 28 additions & 13 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
Copyright 2009-2021 Sam Foster <[email protected]>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
BSD 3-Clause License

Copyright (c) 2009-2024, Sam Foster

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Durdraw
_| |__ __ _____ __| |_____ _____ __ __ __
/ _ | | | __| _ | __| _ | | | |\
/_____|_____|__|__|_____|__|___\____|________| |
\_____________________________________________\| v 0.25.3
\_____________________________________________\| v 0.26.0

![durdraw-0 24 0-example](https://github.com/cmang/durdraw/assets/261501/27efcf7c-96ae-4930-8360-21276dc72fca)

Expand Down Expand Up @@ -159,11 +159,11 @@ Use the arrow keys (or mouse) and other keys to edit, much like a text editor.
You can use the "Esc" (or "Meta") key to access commands:

```
.. Art Editing ..................... .. About ...........................
: F1-F10 - insert character : : version: {ver} :
: esc-up - next fg color : : color mode: {colormode} :
: esc-down - prev fg color : : character encoding: {charmode} :
: esc-right - next bg color (16c) : :..................................:
.. Art Editing .....................
: F1-F10 - insert character :
: esc-up - next fg color :
: esc-down - prev fg color :
: esc-right - next bg color (16c) :
: esc-left - prev bg color :
: esc-/ - insert line : .. Animation .......................
: esc-' - delete line : : esc-k - next frame :
Expand Down Expand Up @@ -192,6 +192,7 @@ You can use the "Esc" (or "Meta") key to access commands:
: esc-> - insert column : : esc-h - help :
: esc-< - delete column : : esc-q - quit :
:..................................: :..................................:
Prev Next
Frame Frame
| |
Expand Down Expand Up @@ -299,7 +300,7 @@ For PNG and animated GIF export, install Ansilove (https://ansilove.org/) and ma
## FAQ

#### Q: Don't TheDraw and some other programs already do ANSI animation?
A: Yes, but traditional ANSI animation does not provide any control over timing, instead relying on terminal baud rate to control the speed. This does not work well on modern systems without baud rate emulation. Durdraw gives the artist fine control over frame rate, and delays per frame. Traditional ANSI animation also updates the animation one character at a time, while Durdraw updates the animation a full frame at a time. This makes it less vulnerable to visual corruption from things like errant terminal characters, resized windows, line noise, etc. Finally, unlike TheDraw, which requires MS-DOS, Durdraw runs in modern Unicode terminals.
A: Yes, but traditional ANSI animation does not provide any control over timing, instead relying on terminal baud rate to govern the playback speed. This does not work well on modern systems without baud rate emulation. Durdraw gives the artist fine control over frame rate, and delays per frame. Traditional ANSI animation also updates the animation one character at a time, while Durdraw updates the animation a full frame at a time. This makes it less vulnerable to visual corruption from things like errant terminal characters, resized windows, line noise, etc. Finally, unlike TheDraw, which requires MS-DOS, Durdraw runs in modern Unicode terminals.

#### Q: Can I run Durdraw in Windows?
A: Short answer: It's not supported, but it seems to work fine in the Windows Subsystem for Linux (WSL). Long answer: Some versions run fine in Windows Command Prompt, Windows Terminal, etc, without WSL, but it's not tested or supported. If you want to help make Durdraw work better in Windows, please help by testing, submitting bug reports and submitting patches.
Expand All @@ -308,7 +309,7 @@ A: Short answer: It's not supported, but it seems to work fine in the Windows Su
A: Probably not easily. Durdraw requires Python 3 and Ncurses. If your platform can support these, it will probably run. However, the file format for Durdraw movies is a plain text JSON format. It should be possible to support this format in different operating systems and in different applications.

#### Q: Does Durdraw support IBM-PC ANSI art?
A: Yes! IBM-PC ANSI art popular in the "ANSI Art Scene" uses Code Page 437 character encoding, which is not usually compatible with modern terminals. When Durdraw encounters these files, it will convert them to Unicode and carry on. When you save ANSI files, it will ask if you want to use CP437 or Utf-8 encoding.
A: Yes! IBM-PC ANSI art popular in the "ANSI Art Scene" uses Code Page 437 character encoding, which usually needs to be translated to work with modern terminals. When Durdraw encounters these files, it will convert them to Unicode and carry on. When you save ANSI files, it will ask if you want to use CP437 or Utf-8 encoding.

### CREDITS

Expand All @@ -322,17 +323,7 @@ ANSI and ASCII artists: cmang, H7, LDA

### LEGAL

Durdraw is Copyright (c) 2009-2023 Sam Foster <[email protected]>. All rights reserved.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
Durdraw is Copyright (c) 2009-2024 Sam Foster <[email protected]>. All rights reserved.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
This software is distributed under the BSD 3-Clause License. See LICENSE file for details.

29 changes: 25 additions & 4 deletions durdraw.1
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH DURDRAW "1" "January 2024" "durdraw 0.24.1" "User Commands"
.\" I edited it. Bad boys, bad boys. -Sam
.\" __ __
.\" _| |__ __ _____ __| |_____ _____ __ __ __
.\" / _ | | | __| _ | __| _ | | | |\
.\" /_____|_____|__|__|_____|__|___\____|________| |
.\" \_____________________________________________\|
.TH DURDRAW "1" "March 2024" "durdraw 0.26.0" "User Commands"
.SH NAME
durdraw \- versatile ASCII and ANSI Art text editor for drawing in terminal
.SH DESCRIPTION
usage: durdraw [\-h] [\-p PLAY [PLAY ...]] [\-\-startup | \fB\-w\fR | \fB\-x\fR TIMES]
.IP
.SH SYNOPSIS
.br
.B durdraw
[\-h] [\-p PLAY [PLAY ...]] [\-\-startup | \fB\-w\fR | \fB\-x\fR TIMES]
[\-\-256color | \fB\-\-16color]\fR [\-b] [\-W WIDTH] [\-H HEIGHT] [\-m]
[\-\-nomouse] [\-\-cursor CURSOR] [\-\-notheme] [\-\-theme THEME]
[\-\-cp437] [\-\-export\-ansi] [\-u UNDOSIZE] [\-V]
[filename]
.SH DESCRIPTION
Durdraw
is an ASCII, ANSI and Unicode art editor for UNIX-like systems (Linux,
macOS, etc). It runs in modern Utf-8 terminals and supports frame-based
animation, custom themes, 256 and 16 color modes, terminal mouse input,
DOS ANSI art viewing, CP437 and Unicode mixing and conversion, HTML output,
mIRC color output, and other interesting features.
.PP
Durdraw is heavily inspired by classic ANSI editing software for MS-DOS
and Windows, such as TheDraw, Aciddraw and Pablodraw, but with a modern Unix
twist.
.PP
.SS "positional arguments:"
.TP
filename
Expand Down Expand Up @@ -75,3 +94,5 @@ Set the number of undo history states \- default is
.TP
\fB\-V\fR, \fB\-\-version\fR
Show version number and exit
.SH AUTHOR
Durdraw is primarily written by Sam Foster <[email protected]>. For a full list of contributors, please see the Github page: https://github.com/cmang/durdraw
3 changes: 3 additions & 0 deletions durdraw/durdraw_appstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ def __init__(self): # User friendly defeaults
self.colorPickChar = self.blockChar
self.hasMouse = True # replace with equivalent curses.has_mouse()
self.hasMouseScroll = True # Disable for compatibility with older Python versions <3.10
self.mouse_col = 0
self.mouse_line = 0
self.helpMov = None
self.helpMov_2 = None
self.hasHelpFile = False
self.playingHelpScreen = False
self.playingHelpScreen_2 = False # on page 2 of help screen
self.durVer = None
self.debug = False
self.debug2 = False # extra verbose debug, eg: file loading intricates
self.modified = False
self.durhelp256_fullpath = None
self.durhelp256_page2_fullpath = None
Expand Down
27 changes: 21 additions & 6 deletions durdraw/durdraw_movie.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from copy import deepcopy
from durdraw.durdraw_options import Options
import json
import pdb

def init_list_colorMap(width, height):
""" Builds a color map consisting of a list of lists """
Expand Down Expand Up @@ -76,15 +77,29 @@ def __init__(self, width, height):
self.setDelayValue(0)

def flip_horizontal(self):
#pdb.set_trace()
self.content = self.content[::-1]
self.newColorMap.reverse()
#for x in range(0, self.height):
# #for y in range(0, self.width):
# # reverse slicing trick
# self.content[x] = self.content[x][::-1]
# #self.content[x][0] = self.content[x][0][::-1]
# self.newColorMap[x].reverse()

def flip_vertical(self):
for x in range(0, self.height):
self.content[x].reverse()
#for y in range(0, self.width):
# reverse slicing trick
self.content[x] = self.content[x][::-1]
#self.content[x][0] = self.content[x][0][::-1]
self.newColorMap[x].reverse()

def flip_horizontal_segment(self, startPoint, height, width, frange=None):
""" Finish writing this, use it for the alt-k select """
for x in range(0, self.height):
self.content[x].reverse()
self.newColorMap[x].reverse()
#def flip_horizontal_segment(self, startPoint, height, width, frange=None):
# """ Finish writing this, use it for the alt-k select """
# for x in range(0, self.height):
# self.content[x].reverse()
# self.newColorMap[x].reverse()


def setWidth(self, width):
Expand Down
Loading

0 comments on commit 11f73d1

Please sign in to comment.