Compare commits
No commits in common. "f43b5a5dc53f5975d7ba9adfdfc562f9661d86b2" and "8ad720afc8803451ecdebdf718481f640528c762" have entirely different histories.
f43b5a5dc5
...
8ad720afc8
@ -31,7 +31,7 @@
|
|||||||
{
|
{
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.bugsy.cz/beval/roster.git",
|
"url": "https://git.bugsy.cz/beval/roster.git",
|
||||||
"tag": "v0.8.3"
|
"tag": "v0.8.2"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
project('roster',
|
project('roster',
|
||||||
version: '0.8.3',
|
version: '0.8.2',
|
||||||
meson_version: '>= 1.0.0',
|
meson_version: '>= 1.0.0',
|
||||||
default_options: [ 'warning_level=2', 'werror=false', ],
|
default_options: [ 'warning_level=2', 'werror=false', ],
|
||||||
)
|
)
|
||||||
|
|||||||
@ -924,9 +924,6 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
language = self._get_language_from_content_type(content_type)
|
language = self._get_language_from_content_type(content_type)
|
||||||
source_buffer.set_language(language)
|
source_buffer.set_language(language)
|
||||||
|
|
||||||
# Switch to body tab
|
|
||||||
self.response_stack.set_visible_child_name("body")
|
|
||||||
|
|
||||||
def display_error(self, error: str) -> None:
|
def display_error(self, error: str) -> None:
|
||||||
"""Display error in this tab's UI."""
|
"""Display error in this tab's UI."""
|
||||||
self.status_label.set_text("Error")
|
self.status_label.set_text("Error")
|
||||||
@ -1153,18 +1150,6 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def _is_json_content_type(self, content_type):
|
|
||||||
"""Check if the content type is JSON or a JSON-based format."""
|
|
||||||
return ('application/json' in content_type
|
|
||||||
or 'text/json' in content_type
|
|
||||||
or '+json' in content_type)
|
|
||||||
|
|
||||||
def _is_xml_content_type(self, content_type):
|
|
||||||
"""Check if the content type is XML or an XML-based format."""
|
|
||||||
return ('application/xml' in content_type
|
|
||||||
or 'text/xml' in content_type
|
|
||||||
or '+xml' in content_type)
|
|
||||||
|
|
||||||
def _get_language_from_content_type(self, content_type):
|
def _get_language_from_content_type(self, content_type):
|
||||||
"""Get GtkSourceView language ID from content type."""
|
"""Get GtkSourceView language ID from content type."""
|
||||||
if not content_type:
|
if not content_type:
|
||||||
@ -1172,9 +1157,9 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
|
|
||||||
language_manager = GtkSource.LanguageManager.get_default()
|
language_manager = GtkSource.LanguageManager.get_default()
|
||||||
|
|
||||||
if self._is_json_content_type(content_type):
|
if 'application/json' in content_type or 'text/json' in content_type:
|
||||||
return language_manager.get_language('json')
|
return language_manager.get_language('json')
|
||||||
elif self._is_xml_content_type(content_type):
|
elif 'application/xml' in content_type or 'text/xml' in content_type:
|
||||||
return language_manager.get_language('xml')
|
return language_manager.get_language('xml')
|
||||||
elif 'text/html' in content_type:
|
elif 'text/html' in content_type:
|
||||||
return language_manager.get_language('html')
|
return language_manager.get_language('html')
|
||||||
@ -1191,10 +1176,10 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
return body
|
return body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self._is_json_content_type(content_type):
|
if 'application/json' in content_type or 'text/json' in content_type:
|
||||||
parsed = json.loads(body)
|
parsed = json.loads(body)
|
||||||
return json.dumps(parsed, indent=2, ensure_ascii=False)
|
return json.dumps(parsed, indent=2, ensure_ascii=False)
|
||||||
elif self._is_xml_content_type(content_type):
|
elif 'application/xml' in content_type or 'text/xml' in content_type:
|
||||||
dom = xml.dom.minidom.parseString(body)
|
dom = xml.dom.minidom.parseString(body)
|
||||||
return dom.toprettyxml(indent=" ")
|
return dom.toprettyxml(indent=" ")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -1183,8 +1183,9 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Apply variable substitution if environment is selected
|
# Apply variable substitution if environment is selected
|
||||||
def show_export(env):
|
|
||||||
substituted_request = request
|
substituted_request = request
|
||||||
|
if widget.selected_environment_id:
|
||||||
|
env = widget.get_selected_environment()
|
||||||
if env:
|
if env:
|
||||||
from .variable_substitution import VariableSubstitution
|
from .variable_substitution import VariableSubstitution
|
||||||
substituted_request, undefined = VariableSubstitution.substitute_request(request, env)
|
substituted_request, undefined = VariableSubstitution.substitute_request(request, env)
|
||||||
@ -1200,11 +1201,6 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
dialog = ExportDialog(substituted_request)
|
dialog = ExportDialog(substituted_request)
|
||||||
dialog.present(self)
|
dialog.present(self)
|
||||||
|
|
||||||
if widget.selected_environment_id:
|
|
||||||
widget.get_selected_environment(show_export)
|
|
||||||
else:
|
|
||||||
show_export(None)
|
|
||||||
|
|
||||||
def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None):
|
def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None):
|
||||||
"""Mark the current tab as saved (clear modified flag)."""
|
"""Mark the current tab as saved (clear modified flag)."""
|
||||||
page = self.tab_view.get_selected_page()
|
page = self.tab_view.get_selected_page()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user