Skip to content

Commit

Permalink
add create bingo area option
Browse files Browse the repository at this point in the history
  • Loading branch information
kaalleen committed Sep 11, 2022
1 parent 5f60c3f commit cc291ea
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Make a file
shell: bash
run: |
7z a bingo-${{ github.ref_name }}.zip bingo/ resources/ README.md LICENSE
7z a bingo-${{ github.ref_name }}.zip bingo.py bingo.inx README.md LICENSE samples/ preview/
- name: Upload Bingo zip
uses: actions/upload-artifact@v3
with:
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ Works with Inkscape 1.2
* Open Extensions > Render > Bingo Card Creator
* Set parameters as necessary and apply

![Bingo params preview](resources/preview.jpg)
![Bingo params preview](preview/preview.jpg)

## Bingo Templates

When a template has been opened in Inkscape before this extension is run, it will insert the bingo numbers into the predefined area(s).
When the extension is used on a document (template) with a bingo area, it will insert the bingo numbers into the predefined area(s) with predefined settings.

Create a bingo template by setting the id of a rectangle to `bingo-area`. For multiple areas append numbers to the id such as `bingo-area_1`. Clones of bingo-area-rectangles or clones of groups can also be used by setting their id accordingly.
### Create Bingo Areas

* Open the Bingo Card Creator extension and set your content and layout settings.
* Switch to the template tab and enable `create bingo area` and apply.

![Bingo template param](preview/create_bingo_area.jpg)

This will include a bingo area into your document. You can now design your template. Group your design, select the group and clone the group. Label the clone to `Bingo Area` in the layer and objects dialog (Object > Layers and Objects). Create as many clones as you need. When finished run the Bingo Card Creator extension again. Disable create bingo area in the template tab and apply. All bingo areas will be filled with random numbers at once.

### Manual setup of bingo areas

Create a bingo template by setting the label of a rectangle to `Bingo Area`. Clones of bingo-area-rectangles or clones of groups can also be used by setting their label accordingly. Optionally append numbers to the label such as `Bingo Area #1` when multiple areas are in the document.

Use Inkscapes XML-Editor to add following attributes to the bingo-area-rectangle (optional):

Expand Down Expand Up @@ -51,4 +62,4 @@ Use Inkscapes XML-Editor to add following attributes to the bingo-area-rectangle

If an attribute remains undefined, settings from user input will apply. Attributes will be carried over to subsequent areas - until overwritten.

For a better understanding have a look at the [template example file](resources/template_example.svg) in this repository.
For a better understanding have a look at the samples in this repository.
35 changes: 26 additions & 9 deletions bingo/bingo.inx → bingo.inx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,46 @@
</effects-menu>
</effect>
<param name="tabs" type="notebook">
<page name="content" gui-text="Content">
<page name="content-tab" gui-text="Content">
<param name="card_header" type="string" gui-text="Headline">BINGO</param>
<param name="rows" type="int" gui-text="Rows" min="0" max="50">5</param>
<param name="columns" type="int" gui-text="Columns" min="0" max="50">5</param>
<param name="num_range" type="int" gui-text="Number range per column" min="0" max="50">15</param>
<param name="free_rows" type="int" gui-text="Free spaces per row" min="0" max="50">0</param>
<param name="num_range" type="int" gui-text="Number range per column"
min="0" max="50">15</param>
<param name="free_rows" type="int" gui-text="Free spaces per row"
min="0" max="50">0</param>
<param name="free_center" type="boolean" gui-text="Free space at center">true</param>
<spacer />
<separator />
<spacer />
<label>☛ If used on a bingo template your custom settings may be overwritten by the template.</label>
<label>☛ If used on a bingo template your custom settings may be overwritten by the
template.</label>
</page>
<page name="layout" gui-text="Layout">
<param name="font_size" type="float" gui-text="Font Size" min="0" max="200" precision="2">14</param>
<param name="header_color" type="color" gui-text="Header Color" appearance="colorbutton">0x990000ff</param>
<param name="num_color" type="color" gui-text="Numbers Color" appearance="colorbutton">0x000000ff</param>
<param name="grid_size" type="float" gui-text="Grid Size" min="0" max="500" precision="2">20</param>
<page name="layout-tab" gui-text="Layout">
<param name="font_size" type="float" gui-text="Font Size" min="0" max="200"
precision="2">14</param>
<param name="header_color" type="color" gui-text="Header Color"
appearance="colorbutton">0x990000ff</param>
<param name="num_color" type="color" gui-text="Numbers Color"
appearance="colorbutton">0x000000ff</param>
<param name="grid_size" type="float" gui-text="Grid Size" min="0" max="500"
precision="2">20</param>
<spacer />
<separator />
<spacer />
<param name="render_grid" type="boolean" gui-text="Render Grid">true</param>
<param name="stroke_width" type="float" gui-text="Stroke width" precision="2">1</param>
</page>
<page name="template-tab" gui-text="Template">
<label appearance="header">Template Creation Helper</label>
<param name="create_area" type="boolean" gui-text="Create bingo area">false</param>
<label>☛ If enabled a bingo area rectangle with content and layout settings will be
placed into the document. This area will be filled with random bingo numbers the
next time this extension is run (with create bingo area disabled).</label>
<label>☛ The area can be copied or cloned. For more complex templates it is even possible
to clone an entire group with a bingo area included. The label for copies and
clones also need to start with "Bingo Area".</label>
</page>
</param>
<script>
<command reldir="extensions" interpreter="python">bingo.py</command>
Expand Down
Loading

0 comments on commit cc291ea

Please sign in to comment.