Skip to content

Commit

Permalink
Add TextAreaInput element type
Browse files Browse the repository at this point in the history
__init__.py, inputs.py, and plugins.py
  • Loading branch information
jerlendds committed Dec 19, 2023
1 parent b459f1a commit 9149d9d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/osintbuddy/elements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
DropdownInput,
NumberInput,
DecimalInput,
TextAreaInput
)
25 changes: 25 additions & 0 deletions src/osintbuddy/elements/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,31 @@ def to_dict(self):
return self._base_entity_element(**self.element)


class TextAreaInput(BaseInput):
"""The TextInput class represents a text input node used
in the OsintBuddy plugin system.
value : str
The value stored in the element.
icon : str
The icon to be displayed with the input element.
default : str
The default value for the input element.
Usage Example:
class Plugin(OBPlugin):
node = [TextInput(label='Email search', placeholder='Enter email')]
"""
element_type: str = "textarea"

def __init__(self, value="", default="", icon="IconAlphabetLatin", **kwargs):
super().__init__(**kwargs)
self.element = {
"value": value,
}
def to_dict(self):
return self._base_entity_element(**self.element)


class DropdownInput(BaseInput):
"""
The DropdownInput class represents a dropdown menu node used
Expand Down
9 changes: 5 additions & 4 deletions src/osintbuddy/plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, imp, importlib, inspect
import os, imp, importlib, inspect, sys
from typing import List, Any, Callable
from collections import defaultdict
from pydantic import BaseModel, ConfigDict
Expand Down Expand Up @@ -280,9 +280,10 @@ async def get_transform(self, transform_type: str, entity, use: OBAuthorUse) ->
]
return transform
except (Exception, OBPluginError) as e:
if isinstance(e, OBPluginError):
raise OBPluginError(e)
raise OBPluginError(f'This plugin has run into an unhandled error: {e}')
raise e
# exc_type, exc_obj, exc_tb = sys.exc_info()
# fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
# raise OBPluginError(f"Unhandled plugin error! {exc_type}\nPlease see {fname} on line no. {exc_tb.tb_lineno}\n{e}")
return None

@staticmethod
Expand Down

0 comments on commit 9149d9d

Please sign in to comment.