1
From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca@debian.org>
2
Date: Tue, 31 Jul 2012 22:40:10 +0200
3
Subject: from upstream fix 1098
6
spyderlib/plugins/editor.py | 14 +++++++-------
7
spyderlib/widgets/editor.py | 22 +++++++++++++++++-----
8
spyderlib/widgets/tabs.py | 22 +++++++++++++++++-----
9
3 files changed, 41 insertions(+), 17 deletions(-)
11
diff --git a/spyderlib/plugins/editor.py b/spyderlib/plugins/editor.py
12
index 58ee269..4054d32 100644
13
--- a/spyderlib/plugins/editor.py
14
+++ b/spyderlib/plugins/editor.py
16
-# -*- coding: utf-8 -*-
17
+# -*- coding: utf-8 -*-
19
# Copyright © 2009-2010 Pierre Raybaut
20
# Licensed under the terms of the MIT License
21
@@ -997,9 +997,9 @@ class Editor(SpyderPluginWidget):
22
self.connect(editorstack, SIGNAL('editor_focus_changed()'),
23
self.main.plugin_focus_changed)
25
- self.connect(editorstack, SIGNAL('close_file(long,long)'),
26
+ self.connect(editorstack, SIGNAL('close_file(QString,int)'),
27
self.close_file_in_all_editorstacks)
28
- self.connect(editorstack, SIGNAL('file_saved(long,long)'),
29
+ self.connect(editorstack, SIGNAL('file_saved(QString, int)'),
30
self.file_saved_in_editorstack)
32
self.connect(editorstack, SIGNAL("create_new_window()"),
33
@@ -1052,18 +1052,18 @@ class Editor(SpyderPluginWidget):
34
self.register_widget_shortcuts("Editor", finfo.editor)
37
- def close_file_in_all_editorstacks(self, editorstack_id, index):
38
+ def close_file_in_all_editorstacks(self, editorstack_id_str, index):
39
for editorstack in self.editorstacks:
40
- if id(editorstack) != editorstack_id:
41
+ if str(id(editorstack)) != editorstack_id_str:
42
editorstack.blockSignals(True)
43
editorstack.close_file(index, force=True)
44
editorstack.blockSignals(False)
47
- def file_saved_in_editorstack(self, editorstack_id, index):
48
+ def file_saved_in_editorstack(self, editorstack_id_str, index):
49
"""A file was saved in editorstack, this notifies others"""
50
for editorstack in self.editorstacks:
51
- if id(editorstack) != editorstack_id:
52
+ if str(id(editorstack)) != editorstack_id_str:
53
editorstack.file_saved_in_other_editorstack(index)
56
diff --git a/spyderlib/widgets/editor.py b/spyderlib/widgets/editor.py
57
index 72adbcb..e947b79 100644
58
--- a/spyderlib/widgets/editor.py
59
+++ b/spyderlib/widgets/editor.py
60
@@ -1193,7 +1193,13 @@ class EditorStack(QWidget):
61
self.outlineexplorer.remove_editor(finfo.editor)
63
self.remove_from_data(index)
64
- self.emit(SIGNAL('close_file(long,long)'), id(self), index)
66
+ # We pass self object ID as a QString, because otherwise it would
67
+ # depend on the platform: long for 64bit, int for 32bit. Replacing
68
+ # by long all the time is not working on some 32bit platforms
69
+ # (see Issue 1094, Issue 1098)
70
+ self.emit(SIGNAL('close_file(QString,int)'), str(id(self)), index)
72
if not self.data and self.is_closable:
73
# editortabwidget is empty: removing it
74
# (if it's not the first editortabwidget)
75
@@ -1284,7 +1290,13 @@ class EditorStack(QWidget):
76
finfo.newly_created = False
77
self.emit(SIGNAL('encoding_changed(QString)'), finfo.encoding)
78
finfo.lastmodified = QFileInfo(finfo.filename).lastModified()
79
- self.emit(SIGNAL('file_saved(long,long)'), id(self), index)
81
+ # We pass self object ID as a QString, because otherwise it would
82
+ # depend on the platform: long for 64bit, int for 32bit. Replacing
83
+ # by long all the time is not working on some 32bit platforms
84
+ # (see Issue 1094, Issue 1098)
85
+ self.emit(SIGNAL('file_saved(QString,int)'), str(id(self)), index)
87
finfo.editor.document().setModified(False)
88
self.modification_changed(index=index)
89
self.analyze_script(index)
90
@@ -2326,7 +2338,7 @@ class EditorPluginExample(QSplitter):
91
font = QFont("Courier New")
93
editorstack.set_default_font(font, color_scheme='Spyder')
94
- self.connect(editorstack, SIGNAL('close_file(long,long)'),
95
+ self.connect(editorstack, SIGNAL('close_file(QString,int)'),
96
self.close_file_in_all_editorstacks)
97
self.connect(editorstack, SIGNAL("create_new_window()"),
98
self.create_new_window)
99
@@ -2369,9 +2381,9 @@ class EditorPluginExample(QSplitter):
100
def get_focus_widget(self):
103
- def close_file_in_all_editorstacks(self, editorstack_id, index):
104
+ def close_file_in_all_editorstacks(self, editorstack_id_str, index):
105
for editorstack in self.editorstacks:
106
- if id(editorstack) != editorstack_id:
107
+ if str(id(editorstack)) != editorstack_id_str:
108
editorstack.blockSignals(True)
109
editorstack.close_file(index, force=True)
110
editorstack.blockSignals(False)
111
diff --git a/spyderlib/widgets/tabs.py b/spyderlib/widgets/tabs.py
112
index aff1556..24a8f34 100644
113
--- a/spyderlib/widgets/tabs.py
114
+++ b/spyderlib/widgets/tabs.py
115
@@ -76,9 +76,15 @@ class TabBar(QTabBar):
117
index_to = self.count()
118
if mimeData.data("tabbar-id").toLong()[0] != id(self):
119
- tabwidget_from = mimeData.data("tabwidget-id").toLong()[0]
120
- self.emit(SIGNAL("move_tab(long,int,int)"),
121
+ tabwidget_from = str(mimeData.data("tabwidget-id").toLong()[0])
123
+ # We pass self object ID as a QString, because otherwise it would
124
+ # depend on the platform: long for 64bit, int for 32bit. Replacing
125
+ # by long all the time is not working on some 32bit platforms
126
+ # (see Issue 1094, Issue 1098)
127
+ self.emit(SIGNAL("move_tab(QString,int,int)"),
128
tabwidget_from, index_from, index_to)
130
event.acceptProposedAction()
131
elif index_from != index_to:
132
self.emit(SIGNAL("move_tab(int,int)"), index_from, index_to)
133
@@ -246,7 +252,7 @@ class Tabs(BaseTabs):
134
corner_widgets, menu_use_tooltips)
135
tab_bar = TabBar(self, parent)
136
self.connect(tab_bar, SIGNAL('move_tab(int,int)'), self.move_tab)
137
- self.connect(tab_bar, SIGNAL('move_tab(long,int,int)'),
138
+ self.connect(tab_bar, SIGNAL('move_tab(QString,int,int)'),
139
self.move_tab_from_another_tabwidget)
140
self.setTabBar(tab_bar)
141
self.index_history = []
142
@@ -303,5 +309,11 @@ class Tabs(BaseTabs):
143
def move_tab_from_another_tabwidget(self, tabwidget_from,
144
index_from, index_to):
145
"""Move tab from a tabwidget to another"""
146
- self.emit(SIGNAL('move_tab(long,long,int,int)'),
147
- tabwidget_from, id(self), index_from, index_to)
149
+ # We pass self object IDs as QString objs, because otherwise it would
150
+ # depend on the platform: long for 64bit, int for 32bit. Replacing
151
+ # by long all the time is not working on some 32bit platforms
152
+ # (see Issue 1094, Issue 1098)
153
+ self.emit(SIGNAL('move_tab(QString,QString,int,int)'),
154
+ tabwidget_from, str(id(self)), index_from, index_to)