Commit 4f01262f authored by SupunGurusinghe's avatar SupunGurusinghe

Packaging app

parent b175817b
......@@ -10,7 +10,7 @@ def index():
if request.method == 'POST':
input_text = request.form.get('input_text')
# Perform processing on input_text and set processed_result
processed_result = f"Processed: {input_text.upper()}" # Example processing
processed_result = f"Processed: {input_text}" # Example processing
return render_template('index.html', processed_result=processed_result)
......@@ -19,7 +19,7 @@ def index():
def process():
input_text = request.form.get('input_text')
# Perform processing on input_text and set processed_result
processed_result = f"Processed: {input_text.upper()}" # Example processing
processed_result = f"{input_text}" # Example processing
return jsonify({'processed_result': processed_result})
......
const { app, BrowserWindow } = require('electron');
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.loadFile('templates/index.html');
mainWindow.on('closed', function () {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});
This diff is collapsed.
{
"name": "sinlinguatoolkit",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron": "^26.0.0",
"electron-packager": "^17.1.2"
}
}
......@@ -2,30 +2,53 @@
<html>
<head>
<title>Input Page</title>
<!-- Include Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<form method="post" action="/">
<input type="text" name="input_text">
<button type="submit">Submit</button>
<webview src="http://localhost:5000" style="width: 100%; height: 100%;"></webview>
<div class="container mt-5">
<div class="row">
<div class="col-md-6">
<form id="inputForm">
<div class="form-group">
<label for="inputText">Enter Text:</label>
<textarea class="form-control" id="inputText" rows="5"></textarea>
</div>
<button type="submit" class="btn btn-primary">Process</button>
</form>
<div id="processed-result"></div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="processedResult">Processed Result:</label>
<textarea class="form-control" id="processedResult" rows="5" readonly></textarea>
</div>
<button id="copyButton" class="btn btn-secondary">Copy</button>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
$('form').submit(function (event) {
$('#inputForm').submit(function (event) {
event.preventDefault();
var inputText = $('input[name="input_text"]').val();
var inputText = $('#inputText').val();
$.ajax({
type: 'POST',
url: '/process',
data: { input_text: inputText },
success: function (response) {
$('#processed-result').text(response.processed_result);
$('#processedResult').val(response.processed_result);
}
});
});
$('#copyButton').click(function () {
var copyText = $('#processedResult');
copyText.select();
document.execCommand('copy');
});
});
</script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment