tmis 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b16bdbc21c0f9d4b63fe41cdf1e9d9231adadf88
4
- data.tar.gz: 1fb3cc43905e908ba366d553d6c2ca0bf6315b29
3
+ metadata.gz: e4cc7538f20247e8ad56a375fd38dab9cc0d77b0
4
+ data.tar.gz: 938a8e400a59287bdba3b68b48c871fc0625c9c8
5
5
  SHA512:
6
- metadata.gz: 96eedca7b13c1e27f563ed760661526465f1cfe8d8dbf86bc693f6174a030f94d928379b0eea83ed2458335fd5b53eaf92ce247d486838eaf467ad168e332adc
7
- data.tar.gz: b8e954ac87b95fc06da55a7ae0be693292db0ae792cb3ca01075f852a44418146bb24c8801216906acba9468dbedac9869057801780999efacbcb5c1a1e3c59d
6
+ metadata.gz: 3e6889c713b4c4a2fe7b7b9a62338c63a25a17bb103b1084ae7b93ae41cb09b94fdceee53c716d2b61dc5a81034b58eb0e39bbb7d78059c935c13070a0f825ba
7
+ data.tar.gz: 7c5111415e6295849d839d5ff20cf533e1d223dafcaa1b044e3b6bc2955c9b7442f794638de40c877e8ef68c37b17f66365482f4678bc54e2f4ce1abc4ada508
@@ -14,8 +14,8 @@ class SpreadsheetRoo < AbstractSpreadsheet
14
14
 
15
15
  ##Contract String => Any
16
16
  def initialize(filepath)
17
- @filepath = filepath
18
- @sheet = Roo::Spreadsheet.open(filepath)
17
+ @filepath = filepath.force_encoding("UTF-8")
18
+ @sheet = Roo::Spreadsheet.open(@filepath)
19
19
  @sheet.default_sheet = 0
20
20
  end
21
21
 
@@ -57,7 +57,7 @@ class SpreadsheetSpreadsheet < AbstractSpreadsheet
57
57
 
58
58
  #Contract String => Any
59
59
  def initialize(filepath)
60
- @filepath = filepath
60
+ @filepath = filepath.force_encoding("UTF-8")
61
61
  Spreadsheet.client_encoding = 'UTF-8'
62
62
  if File.file?(@filepath)
63
63
  @book = Spreadsheet.open(@filepath)
@@ -127,6 +127,7 @@ end
127
127
  class SpreadsheetCreater
128
128
  #Contract String => Or[IsA[AbstractSpreadsheet], IsA[WritableSpreadsheet]]
129
129
  def self.create(filename)
130
+ filename = filename.force_encoding("UTF-8")
130
131
  if filename =~ /.*.csv/
131
132
  SpreadsheetRoo.new(File.expand_path(filename))
132
133
  else
@@ -28,7 +28,6 @@ private
28
28
  #Contract [Pos, Pos] => Array
29
29
  def get_days(cols)
30
30
  (7..84).each_slice(13).map{ |i| [i[1], i.last] }.map do |rows|
31
- p @table[rows.first, 1]
32
31
  { name: @table[rows.first, 1], studies: get_studies(rows, cols) }
33
32
  end
34
33
  end
@@ -23,7 +23,7 @@ class ExportGeneralTimetableDialog < Qt::Dialog
23
23
  end
24
24
 
25
25
  def on_browsePushButton_clicked
26
- @ui.pathLineEdit.text = Qt::FileDialog::getSaveFileName(self, 'Save File', 'NewTimetable', 'XLS Spreadsheet(*.xls)')
26
+ @ui.pathLineEdit.text = Qt::FileDialog::getSaveFileName(self, 'Save File', "#{Dir.home}/NewTimetable", 'XLS Spreadsheet(*.xls)')
27
27
  end
28
28
 
29
29
  def on_exportButtonBox_accepted
@@ -38,7 +38,7 @@ class ExportGroupTimetableDialog < Qt::Dialog
38
38
 
39
39
  def on_saveCheckBox_toggled(checked)
40
40
  if checked
41
- if (path = Qt::FileDialog::getExistingDirectory(self, 'Open Directory', '/home', Qt::FileDialog::ShowDirsOnly | Qt::FileDialog::DontResolveSymlinks))
41
+ if (path = Qt::FileDialog::getExistingDirectory(self, 'Open Directory', Dir.home, Qt::FileDialog::ShowDirsOnly | Qt::FileDialog::DontResolveSymlinks))
42
42
  @ui.folderPathLineEdit.text = path # force_encoding doesn't help because Qt changes the encoding to ASCII anyway
43
43
  else
44
44
  @ui.folderPathLineEdit.text = Dir.home
@@ -38,7 +38,7 @@ class ExportLecturerTimetableDialog < Qt::Dialog
38
38
 
39
39
  def on_saveCheckBox_toggled(checked)
40
40
  if checked
41
- if (path = Qt::FileDialog::getExistingDirectory(self, 'Open Directory', '/home', Qt::FileDialog::ShowDirsOnly | Qt::FileDialog::DontResolveSymlinks))
41
+ if (path = Qt::FileDialog::getExistingDirectory(self, 'Open Directory', Dir.home, Qt::FileDialog::ShowDirsOnly | Qt::FileDialog::DontResolveSymlinks))
42
42
  @ui.folderPathLineEdit.text = path # force_encoding doesn't help because Qt changes the encoding to ASCII anyway
43
43
  else
44
44
  @ui.folderPathLineEdit.text = Dir.home
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'about.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'console.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'debug_console.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'edit_study.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'expand_changes.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'export_general_timetable.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:24 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'export_group_timetable.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'export_lecturer_timetable.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'find.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:25 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'import.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:24 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'settings.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:24 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
@@ -221,7 +221,8 @@ class MainWindow < Qt::MainWindow
221
221
  end
222
222
 
223
223
  def on_openAction_triggered
224
- if (filename = Qt::FileDialog::getOpenFileName(self, 'Open File', '', 'TMIS databases (SQLite3)(*.sqlite)'))
224
+ if (filename = Qt::FileDialog::getOpenFileName(self, 'Open File', Dir.home, 'TMIS databases (SQLite3)(*.sqlite)'))
225
+ filename = filename.force_encoding("UTF-8")
225
226
  Database.instance.connect_to filename
226
227
  update_recent filename
227
228
  show_tables
@@ -232,7 +233,7 @@ class MainWindow < Qt::MainWindow
232
233
  end
233
234
 
234
235
  def on_saveAsAction_triggered
235
- if (filename = Qt::FileDialog::getSaveFileName(self, 'Save File', 'NewTimetable.sqlite', 'TMIS databases (SQLite3)(*.sqlite)'))
236
+ if (filename = Qt::FileDialog::getSaveFileName(self, 'Save File', "#{Dir.home}/NewTimetable.sqlite", 'TMIS databases (SQLite3)(*.sqlite)'))
236
237
  filename.force_encoding('UTF-8')
237
238
  FileUtils.cp(Database.instance.path, filename) unless Database.instance.path == filename
238
239
  Database.instance.connect_to filename
@@ -243,7 +244,8 @@ class MainWindow < Qt::MainWindow
243
244
 
244
245
  def on_importAction_triggered
245
246
  please_wait do
246
- if (filename = Qt::FileDialog::getOpenFileName(self, 'Open File', '', 'Spreadsheets(*.xls *.xlsx *.ods *.csv)'))
247
+ if (filename = Qt::FileDialog::getOpenFileName(self, 'Open File', Dir.home, 'Spreadsheets(*.xls *.xlsx *.ods *.csv)'))
248
+ filename = filename.force_encoding('UTF-8')
247
249
  if Database.instance.connected?
248
250
  (id = ImportDialog.new(Date.parse(@ui.dateDateEdit.date.toString(Qt::ISODate)))).exec
249
251
  else
@@ -58,7 +58,10 @@ class SpecialitySubjectTableModel < Qt::AbstractTableModel
58
58
  when 6
59
59
  speciality_subject.consultations_hours
60
60
  when 7
61
- speciality_subject.lecture_hours.try(:+, speciality_subject.practical_hours || 0)
61
+ [speciality_subject.lecture_hours,
62
+ speciality_subject.practical_hours,
63
+ speciality_subject.consultations_hours ].
64
+ keep_if{|x| x.respond_to?(:+) }.inject(:+)
62
65
  when 8
63
66
  speciality_subject.preffered_days
64
67
  when 9
@@ -83,7 +86,10 @@ class SpecialitySubjectTableModel < Qt::AbstractTableModel
83
86
  when 6
84
87
  speciality_subject.consultations_hours
85
88
  when 7
86
- speciality_subject.lecture_hours.try(:+, speciality_subject.practical_hours || 0)
89
+ [speciality_subject.lecture_hours,
90
+ speciality_subject.practical_hours,
91
+ speciality_subject.consultations_hours ].
92
+ keep_if{|x| x.respond_to?(:+) }.inject(:+)
87
93
  when 8
88
94
  speciality_subject.preffered_days
89
95
  when 9
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  ** Form generated from reading ui file 'mainwindow.ui'
3
3
  **
4
- ** Created: Wed Sep 4 00:30:33 2013
4
+ ** Created: Wed Sep 4 12:32:24 2013
5
5
  ** by: Qt User Interface Compiler version 4.8.5
6
6
  **
7
7
  ** WARNING! All changes made in this file will be lost when recompiling ui file!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Mileshkin