Falko Schindler 3 år sedan
förälder
incheckning
b136536e39
4 ändrade filer med 10 tillägg och 10 borttagningar
  1. 3 3
      main.py
  2. 1 1
      nicegui/elements/annotation_tool.js
  3. 5 5
      nicegui/elements/annotation_tool.py
  4. 1 1
      nicegui/ui.py

+ 3 - 3
main.py

@@ -131,9 +131,9 @@ with example(overlay):
             </svg>'''
         ui.svg(svg_content).style('background:transparent')
 
-with example(ui.clicky_image):
-    ui.clicky_image('http://placeimg.com/640/360/geometry',
-                    on_click=lambda e: ui.notify(f'{e.image_x:.1f}, {e.image_y:.1f}'))
+with example(ui.annotation_tool):
+    ui.annotation_tool('http://placeimg.com/640/360/geometry',
+                       on_click=lambda e: ui.notify(f'{e.image_x:.1f}, {e.image_y:.1f}'))
 
 with example(ui.markdown):
     ui.markdown('### Headline\nWith hyperlink to [GitHub](https://github.com/zauberzeug/nicegui).')

+ 1 - 1
nicegui/elements/clicky_image.js → nicegui/elements/annotation_tool.js

@@ -1,4 +1,4 @@
-Vue.component("clicky_image", {
+Vue.component("annotation_tool", {
   template: `<img v-bind:id="jp_props.id" :src="jp_props.options.source"></div>`,
   mounted() {
     console.log(this.$props.jp_props);

+ 5 - 5
nicegui/elements/clicky_image.py → nicegui/elements/annotation_tool.py

@@ -7,17 +7,17 @@ from .element import Element
 
 CustomView.use(__file__)
 
-class ClickyImageView(CustomView):
+class AnnotationToolView(CustomView):
 
     def __init__(self, source: str, on_click: Callable):
-        super().__init__('clicky_image', source=source)
+        super().__init__('annotation_tool', source=source)
         self.allowed_events = ['onClick']
         self.initialize(onClick=on_click)
 
-class ClickyImage(Element):
+class AnnotationTool(Element):
 
     def __init__(self, source: str, on_click: Callable):
-        """Clicky Image
+        """Annotation Tool
 
         Create a special image that handles mouse clicks and yields image coordinates.
 
@@ -25,7 +25,7 @@ class ClickyImage(Element):
         :param on_click: callback for when the user clicks on the image (yields `image_x` and `image_y`)
         """
         self.click_handler = on_click
-        super().__init__(ClickyImageView(source, self.handle_click))
+        super().__init__(AnnotationToolView(source, self.handle_click))
 
     def handle_click(self, msg):
         try:

+ 1 - 1
nicegui/ui.py

@@ -2,9 +2,9 @@ class Ui:
     from .config import config  # NOTE: before run
     from .run import run  # NOTE: before justpy
 
+    from .elements.annotation_tool import AnnotationTool as annotation_tool
     from .elements.button import Button as button
     from .elements.checkbox import Checkbox as checkbox
-    from .elements.clicky_image import ClickyImage as clicky_image
     from .elements.colors import Colors as colors
     from .elements.custom_example import CustomExample as custom_example
     from .elements.dialog import Dialog as dialog