Skip to content

Commit b848d2f

Browse files
committed
#175 - Add 'tsv' file on File.js options
add tsv ssv dsv extention to csv option
1 parent 95ce07a commit b848d2f

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

data/m_library/pandasLibrary.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ define([
238238
default: 'True',
239239
component: 'bool_checkbox'
240240
},
241-
{
242-
name: 'delimiter',
243-
type: 'text',
244-
label: 'Delimiter'
245-
},
246241
{
247242
name: 'index',
248243
type: 'bool',

js/m_apps/File.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Note : Apps > File
77
* License : GNU GPLv3 with Visual Python special exception
88
* Date : 2021. 11. 18
9-
* Change Date :
9+
* Change Date : 2022. 09. 03
1010
*/
1111

1212
//============================================================================
@@ -39,7 +39,6 @@ define([
3939

4040
this.fileExtensions = {
4141
'csv': 'csv',
42-
'tsv': 'tsv',
4342
'excel': 'xlsx',
4443
'json': 'json',
4544
'pickle': ''
@@ -73,7 +72,6 @@ define([
7372
'Read': {
7473
fileTypeId: {
7574
'csv': 'pd004',
76-
'tsv': 'pd004',
7775
'excel': 'pd123',
7876
'json': 'pd076',
7977
'pickle': 'pd079'
@@ -88,7 +86,6 @@ define([
8886
'Write': {
8987
fileTypeId: {
9088
'csv': 'pd005',
91-
'tsv': 'pd005',
9289
'excel': 'pd124',
9390
'json': 'pd077',
9491
'pickle': 'pd078'
@@ -150,7 +147,13 @@ define([
150147
_bindEventByType(pageType) {
151148
var that = this;
152149
var prefix = '#vp_file' + pageType + ' ';
150+
var fileExtensionArr = [that.state.fileExtension];
153151

152+
// add tsv dsv ssv extension to csv option
153+
if(that.state.fileExtension === 'csv'){
154+
fileExtensionArr = fileExtensionArr.concat(['tsv', 'dsv', 'ssv']);
155+
}
156+
154157
// select file type
155158
$(this.wrapSelector(prefix + '#fileType')).change(function() {
156159
var value = $(this).val();
@@ -160,18 +163,18 @@ define([
160163
that.renderPage(pageType);
161164
that._bindEventByType(pageType);
162165
});
163-
166+
164167
// open file navigation
165168
$(this.wrapSelector(prefix + '#vp_openFileNavigationBtn')).click(function() {
166169

167170
let type = 'save';
168171
if (pageType == 'Read') {
169172
type = 'open';
170173
}
171-
174+
172175
let fileNavi = new FileNavigation({
173176
type: type,
174-
extensions: [ that.state.fileExtension ],
177+
extensions: fileExtensionArr,
175178
finish: function(filesPath, status, error) {
176179
let {file, path} = filesPath[0];
177180
that.state.selectedFile = file;
@@ -371,7 +374,7 @@ define([
371374
var sbCode = new com_String;
372375

373376
this.saveState();
374-
377+
375378
var prefix = '#vp_file' + pageType + ' ';
376379
var userOption = new com_String();
377380
var userOptValue = $(this.wrapSelector(prefix + '#userOption')).val();
@@ -390,9 +393,6 @@ define([
390393
type: 'var'
391394
});
392395

393-
if($("#fileType").val() === "tsv"){
394-
$("#delimiter").val('\\' + "t");
395-
}
396396

397397
var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileRead', thisPkg, userOption.toString());
398398
sbCode.append(result);
@@ -403,9 +403,6 @@ define([
403403
type: 'var'
404404
});
405405

406-
if($("#fileType").val() === "tsv"){
407-
$("#delimiter").val('\\' + "t");
408-
}
409406

410407
var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileWrite', thisPkg, userOption.toString());
411408
sbCode.append(result);

0 commit comments

Comments
 (0)