Skip to content

Commit

Permalink
Added addImage :)
Browse files Browse the repository at this point in the history
  • Loading branch information
p4p1 authored Oct 17, 2023
1 parent b4de17c commit f217693
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/Source/Havoc/PythonApi/UI/PyDialogClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PyMethodDef PyDialogClass_methods[] = {
{ "exec", ( PyCFunction ) DialogClass_exec, METH_VARARGS, "Display the window" },
{ "close", ( PyCFunction ) DialogClass_close, METH_VARARGS, "Close the window" },
{ "addLabel", ( PyCFunction ) DialogClass_addLabel, METH_VARARGS, "Insert a label in the window" },
{ "addImage", ( PyCFunction ) DialogClass_addImage, METH_VARARGS, "Insert an image in the window" },
{ "addButton", ( PyCFunction ) DialogClass_addButton, METH_VARARGS, "Insert a button in the window" },
{ "addCheckbox", ( PyCFunction ) DialogClass_addCheckbox, METH_VARARGS, "Insert a checkbox in the window" },
{ "addCombobox", ( PyCFunction ) DialogClass_addCombobox, METH_VARARGS, "Insert a checkbox in the window" },
Expand Down Expand Up @@ -142,6 +143,22 @@ PyObject* DialogClass_addLabel( PPyDialogClass self, PyObject *args )
Py_RETURN_NONE;
}

PyObject* DialogClass_addImage( PPyDialogClass self, PyObject *args )
{
char *text = nullptr;

if( !PyArg_ParseTuple( args, "s", &text) )
{
Py_RETURN_NONE;
}
QPixmap img(text);
QLabel* label = new QLabel(self->DialogWindow->window);
label->setPixmap(img);
self->DialogWindow->layout->addWidget(label);

Py_RETURN_NONE;
}

PyObject* DialogClass_addButton( PPyDialogClass self, PyObject *args )
{
char *text = nullptr;
Expand Down
17 changes: 17 additions & 0 deletions client/Source/Havoc/PythonApi/UI/PyWidgetClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PyMethodDef PyWidgetClass_methods[] = {
{ "setBottomTab", ( PyCFunction ) WidgetClass_setBottomTab, METH_VARARGS, "Set widget as Bottom Tab" },
{ "setSmallTab", ( PyCFunction ) WidgetClass_setSmallTab, METH_VARARGS, "Set widget as Small Tab" },
{ "addLabel", ( PyCFunction ) WidgetClass_addLabel, METH_VARARGS, "Insert a label in the widget" },
{ "addImage", ( PyCFunction ) WidgetClass_addImage, METH_VARARGS, "Insert an image in the widget" },
{ "addButton", ( PyCFunction ) WidgetClass_addButton, METH_VARARGS, "Insert a button in the widget" },
{ "addCheckbox", ( PyCFunction ) WidgetClass_addCheckbox, METH_VARARGS, "Insert a checkbox in the window" },
{ "addCombobox", ( PyCFunction ) WidgetClass_addCombobox, METH_VARARGS, "Insert a checkbox in the window" },
Expand Down Expand Up @@ -134,6 +135,22 @@ PyObject* WidgetClass_addLabel( PPyWidgetClass self, PyObject *args )
Py_RETURN_NONE;
}

PyObject* WidgetClass_addImage( PPyWidgetClass self, PyObject *args )
{
char *text = nullptr;

if( !PyArg_ParseTuple( args, "s", &text) )
{
Py_RETURN_NONE;
}
QPixmap img(text);
QLabel* label = new QLabel(self->WidgetWindow->window);
label->setPixmap(img);
self->WidgetWindow->layout->addWidget(label);

Py_RETURN_NONE;
}

PyObject* WidgetClass_setBottomTab( PPyWidgetClass self, PyObject *args )
{
HavocX::HavocUserInterface->NewBottomTab( self->WidgetWindow->window, self->title);
Expand Down

0 comments on commit f217693

Please sign in to comment.