Exemple #1
0
 def gwindow_set_visible(self, flag, gobj=None, gw=None):
     if (gw != None):
         command = pformat(GWindow_setVisible, id=id(gw), flag=flag)
         self.put_pipe(command)
     elif (gobj != None):
         command = pformat(GObject_setVisible, id=id(gobj), flag=flag)
         self.put_pipe(command)
Exemple #2
0
 def gbufferedimage_resize(self, gobj, width, height, retain):
     command = pformat(GBufferedImage_resize,
                       id=id(gobj),
                       width=int(width),
                       height=int(height),
                       retain=retain)
     self.put_pipe(command)
Exemple #3
0
 def groundrect_constructor(self, gobj, width, height, corner):
     command = pformat(GRoundRect_constructor,
                       id=id(gobj),
                       width=width,
                       height=height,
                       corner=corner)
     self.put_pipe(command)
Exemple #4
0
 def goptionpane_show_input_dialog(self, message, title):
     command = pformat(GOptionPane_showInputDialog,
                       message=message,
                       title=title)
     self.put_pipe(command)
     result = self.get_result()
     return strlib.url_decode(result)
Exemple #5
0
 def goptionpane_show_message_dialog(self, message, title, message_type):
     command = pformat(GOptionPane_showMessageDialog,
                       message=message,
                       title=title,
                       type=message_type.value)
     self.put_pipe(command)
     self.get_result()  # Wait for dialog to close
Exemple #6
0
 def g3drect_constructor(self, gobj, width, height, raised):
     command = pformat(G3DRect_constructor,
                       id=id(gobj),
                       width=width,
                       height=height,
                       raised=raised)
     self.put_pipe(command)
Exemple #7
0
 def gbufferedimage_set_rgb(self, gobj, x, y, rgb):
     command = pformat(GBufferedImage_setRGB,
                       id=id(gobj),
                       x=int(x),
                       y=int(y),
                       rgb=rgb)
     self.put_pipe(command)
Exemple #8
0
 def gline_constructor(self, gobj, x1, y1, x2, y2):
     command = pformat(GLine_constructor,
                       id=id(gobj),
                       x1=x1,
                       y1=y1,
                       x2=x2,
                       y2=y2)
     self.put_pipe(command)
Exemple #9
0
 def garc_set_frame_rectangle(self, gobj, x, y, width, height):
     command = pformat(GArc_setFrameRectangle,
                       id=id(gobj),
                       x=x,
                       y=y,
                       width=width,
                       height=height)
     self.put_pipe(command)
Exemple #10
0
 def garc_constructor(self, gobj, width, height, start, sweep):
     command = pformat(GArc_constructor,
                       id=id(gobj),
                       width=width,
                       height=height,
                       start=start,
                       sweep=sweep)
     self.put_pipe(command)
Exemple #11
0
 def gslider_constructor(self, gobj, min, max, value):
     JavaBackend.SOURCE_TABLE[id(gobj)] = gobj
     command = pformat(GSlider_constructor,
                       id=id(gobj),
                       min=min,
                       max=max,
                       value=value)
     self.put_pipe(command)
Exemple #12
0
 def file_open_file_dialog(self, title, mode, path):
     # TODO: BUGFIX for trailing slashes
     command = pformat(File_openFileDialog,
                       title=title,
                       mode=mode,
                       path=path)
     self.put_pipe(command)
     return self.get_result()
Exemple #13
0
 def goptionpane_show_confirm_dialog(self, message, title, confirm_type):
     command = pformat(GOptionPane_showConfirmDialog,
                       message=message,
                       title=title,
                       type=confirm_type.value)
     self.put_pipe(command)
     result = self.get_result()
     return int(result)
Exemple #14
0
 def goptionpane_show_text_file_dialog(self, message, title, rows, cols):
     command = pformat(GOptionPane_showTextFileDialog,
                       message=strlib.quote_string(
                           strlib.url_encode(message)),
                       title=strlib.quote_string(strlib.url_encode(title)),
                       rows=rows,
                       cols=cols)
     self.put_pipe(command)
     self.get_result()  # Wait for dialog to close
Exemple #15
0
 def gbufferedimage_constructor(self, gobj, x, y, width, height):
     JavaBackend.SOURCE_TABLE[id(gobj)] = gobj
     command = pformat(GBufferedImage_constructor,
                       id=id(gobj),
                       x=int(x),
                       y=int(y),
                       width=int(width),
                       height=int(height))
     self.put_pipe(command)
Exemple #16
0
 def gbufferedimage_fill_region(self, gobj, x, y, width, height, rgb):
     command = pformat(GBufferedImage_fillRegion,
                       id=id(gobj),
                       x=int(x),
                       y=int(y),
                       width=int(width),
                       height=int(height),
                       rgb=rgb)
     self.put_pipe(command)
Exemple #17
0
    def create_sound(self, sound, filename):
        # if(filename[0] != "/" and filename[1:3] != ":\\"):
        #   filename = os.getcwd() + os.sep + filename
        # for i in range(len(filename)):
        #   if(filename[i] == "\\"):
        #       filename = filename[:i] + "/" + filename[i+1:]

        command = pformat(Sound_create, id=id(sound), filename=filename)
        self.put_pipe(command)
Exemple #18
0
    def getNextEvent(self, mask):
        if not JavaBackend.EVENT_QUEUE:

            command = pformat(GEvent_getNextEvent, mask=mask.value)
            self.put_pipe(command)
            self.get_result(consume_acks=True,
                            stop_on_event=True)  # Will add to EVENT_QUEUE?
            if not JavaBackend.EVENT_QUEUE:
                # TODO: hotfix for lecture 9.1
                return gevents.GEvent()
                return None
        return JavaBackend.EVENT_QUEUE.popleft()
Exemple #19
0
 def goptionpane_show_option_dialog(self, message, title, options,
                                    initially_selected):
     command = pformat(GOptionPane_showOptionDialog,
                       message=message,
                       title=title,
                       options=', '.join(
                           map(strlib.quote_string,
                               map(strlib.url_encode, map(str, options)))),
                       initial=initially_selected)
     self.put_pipe(command)
     result = self.get_result()
     return int(result)
Exemple #20
0
    def gimage_constructor(self, gobj, filename):
        if (filename[0] != "/" and filename[1:3] != ":\\"):
            filename = os.getcwd() + os.sep + filename
        for i in range(len(filename)):
            if (filename[i] == "\\"):
                filename = filename[:i] + "/" + filename[i + 1:]

        command = pformat(GImage_constructor, id=id(gobj), filename=filename)
        self.put_pipe(command)
        result = self.get_result()

        if (not result.startswith("GDimension(")): raise Exception(result)
        return self.scanDimension(result)
Exemple #21
0
 def note_play(self, note, repeat):
     note = str(note) + boolalpha(repeat)
     command = pformat(Note_play, note=note)
     self.put_pipe(command)
     self.get_result()  # Wait for playing to be done
Exemple #22
0
 def gfilechooser_show_save_dialog(self, current_dir, file_filter):
     command = pformat(GFileChooser_showOpenDialog,
                       current_dir=current_dir,
                       file_filter=file_filter)
     self.put_pipe(command)
     return self.get_result()
Exemple #23
0
 def setSelectedItem(self, gobj, item):
     command = pformat(GChooser_setSelectedItem,
                       id=id(gobj),
                       item=strlib.quote_string(item))
     self.put_pipe(command)
Exemple #24
0
 def waitForEvent(self, mask):
     while not JavaBackend.EVENT_QUEUE:
         command = pformat(GEvent_waitForEvent, mask=mask.value)
         self.put_pipe(command)
         self.get_result()
     return JavaBackend.EVENT_QUEUE.popleft()
Exemple #25
0
 def gwindow_add_to_region(self, gw, gobj, region):
     command = pformat(GWindow_addToRegion,
                       id=id(gw),
                       gobj_id=id(gobj),
                       region=region)
     self.put_pipe(command)
Exemple #26
0
 def getSelectedItem(self, gobj):
     command = pformat(GChooser_getSelectedItem, id=id(gobj))
     self.put_pipe(command)
     return self.get_result()