@@ -212,16 +212,6 @@ def RegisterModifiedEvent(self, event_handler):
212212 self .Bind (wx .stc .EVT_STC_CHANGE , event_handler )
213213
214214
215- # ---------------------------------------------------------------------------
216- # Constants for module versions
217-
218- modOriginal = 0
219- modModified = 1
220- modDefault = modOriginal
221-
222- # ---------------------------------------------------------------------------
223-
224-
225215def is_utf8_strict (data ):
226216 try :
227217 decoded = data .decode ('UTF-8' )
@@ -240,7 +230,7 @@ def __init__(self, parent, main_frame, filepath=None):
240230 self .log = sys .stdout # From FileDialog
241231 self .path = filepath
242232 self .parent = parent
243- wx .Panel .__init__ (self , parent , size = (1 , 1 ))
233+ wx .Panel .__init__ (self , parent , size = wx . Size (1 , 1 ))
244234 self .mainFrame = main_frame
245235 self .editor = SourceCodeEditor (self , options = {'tab markers' :True , 'fold symbols' :2 })
246236 self .editor .RegisterModifiedEvent (self .on_code_modified )
@@ -397,7 +387,7 @@ def on_button(self, evt):
397387 def on_button2 (self , evt ):
398388 # Create the dialog. In this case the current directory is forced as the starting
399389 # directory for the dialog, and no default file name is forced. This can easilly
400- # be changed in your program. This is an 'save' dialog.
390+ # be changed in your program. This is a 'save' dialog.
401391 #
402392 # Unlike the 'open dialog' example found elsewhere, this example does NOT
403393 # force the current working directory to change if the user chooses a different
@@ -450,86 +440,6 @@ def on_button2(self, evt):
450440
451441# ---------------------------------------------------------------------------
452442
453- def opj (filepath ):
454- """Convert paths to the platform-specific separator"""
455- st = os .path .join (* tuple (filepath .split ('/' )))
456- # HACK: on Linux, a leading / gets lost...
457- if filepath .startswith ('/' ):
458- st = '/' + st
459- return st
460-
461-
462- def get_data_dir ():
463- """
464- Return the standard location on this platform for application data
465- """
466- sp = wx .StandardPaths .Get ()
467- return sp .GetUserDataDir ()
468-
469-
470- def get_modified_directory ():
471- """
472- Returns the directory where modified versions of the Code files
473- are stored
474- """
475- return os .path .join (get_data_dir (), "modified" )
476-
477-
478- def get_modified_filename (name ):
479- """
480- Returns the filename of the modified version of the specified Code
481- """
482- if not name .endswith (".py" ):
483- name = name + ".py"
484- return os .path .join (get_modified_directory (), name )
485-
486-
487- def get_original_filename (name ):
488- """
489- Returns the filename of the original version of the specified Code
490- """
491- if not name .endswith (".py" ):
492- name = name + ".py"
493-
494- if os .path .isfile (name ):
495- return name
496-
497- original_dir = os .getcwd ()
498- list_dir = os .listdir (original_dir )
499- # Loop over the content of the Code directory
500- for item in list_dir :
501- if not os .path .isdir (item ):
502- # Not a directory, continue
503- continue
504- dir_file = os .listdir (item )
505- # See if a file called "name" is there
506- if name in dir_file :
507- return os .path .join (item , name )
508-
509- # We must return a string...
510- return ""
511-
512-
513- def does_modified_exist (name ):
514- """Returns whether the specified Code has a modified copy"""
515- if os .path .exists (get_modified_filename (name )):
516- return True
517- else :
518- return False
519-
520-
521- def get_config ():
522- if not os .path .exists (get_data_dir ()):
523- os .makedirs (get_data_dir ())
524-
525- config = wx .FileConfig (
526- localFilename = os .path .join (get_data_dir (), "options" ))
527- return config
528-
529-
530- _platformNames = ["wxMSW" , "wxGTK" , "wxMac" ]
531-
532-
533443def main (filepath , frame = None ):
534444 __name__ = f'Code Editor: { filepath } '
535445 app = wx .App ()
@@ -539,7 +449,7 @@ def main(filepath, frame=None):
539449 CodeEditorPanel (frame , None , filepath )
540450 image_provider = ImageProvider ()
541451 frame .SetTitle (filepath )
542- frame .SetSize ((800 , 600 ))
452+ frame .SetSize (wx . Size (800 , 600 ))
543453 frame .SetIcon (wx .Icon (image_provider .RIDE_ICON ))
544454 frame .CenterOnScreen ()
545455 frame .Show (True )
0 commit comments