Esempio n. 1
0
    def replace(self) -> None:
        """Replaces the color (ro, go, bo, ao) with the color (rn, gn, bn, an)"""
        # colors to be replaced
        ro = self.old_color.red.get()
        go = self.old_color.green.get()
        bo = self.old_color.blue.get()
        ao = self.old_color.alpha.get()

        # colors to replace with
        rn = self.new_color.red.get()
        gn = self.new_color.green.get()
        bn = self.new_color.blue.get()
        an = self.new_color.alpha.get()

        try:
            self.gui.editor.replace_color(ro=ro,
                                          go=go,
                                          bo=bo,
                                          ao=ao,
                                          rn=rn,
                                          gn=gn,
                                          bn=bn,
                                          an=an)
        except custom_errors.InvalidRGBAError:
            pop.Popup("Invalid Input")
        except custom_errors.NoImageError:
            pop.Popup("No Image Found")
        else:
            pop.Popup("Success")
 def reload_file(self) -> None:
     """Reloads uploaded file and removes edited file"""
     file_name = self.gui.label_file_explorer.cget("text")
     if file_name:
         self.gui.load_img(file_name)
         pop.Popup("Success")
     else:
         pop.Popup("Nothing To Reload")
 def resize(self) -> None:
     """Converts input ratios if possible and resizes loaded image using the ratio. Also updates image dimension
      information. If resize not possible error popup displayed"""
     try:
         self.editor.resize(self.x_input.get(), self.y_input.get())
     except ValueError:
         pop.Popup("Not A Valid Input, Only Numbers Allowed")
     except custom_errors.NoImageError:
         pop.Popup("No Image Loaded")
     else:
         self.resize_x.configure(
             text=f"Resized X Size: {self.editor.edited_img.size[0]}")
         self.resize_y.configure(
             text=f"Resized Y Size: {self.editor.edited_img.size[1]}")
         pop.Popup("Success")
Esempio n. 4
0
 def view_edited_colors(self) -> None:
     """shows a display of all unique colors in the edited image"""
     try:
         colors = self.gui.editor.unique_colors_edited()
     except custom_errors.NoImageError:
         pop.Popup("No Image Found")
     else:
         Table(colors, "Unique Colors In Loaded Image")
 def save_file(self) -> None:
     """Saves edited image if any, creates error popup if none"""
     if self.gui.editor.edited_img:
         file = filedialog.asksaveasfile(mode="w", filetypes=self.gui.editor.VALID_FILE_TYPES,
                                         defaultextension=".png")
         if file:
             self.gui.editor.edited_img.save(file.name, dpi=(300, 300))
     else:
         pop.Popup("No Edited Image Found")
Esempio n. 6
0
    def OnShowPopup(self, evt):
        win = popup.Popup(self, quickhelp)

        # Show the popup right below or above the button
        # depending on available screen space...
        btn = evt.GetEventObject()
        pos = btn.ClientToScreen((0, 0))
        sz = btn.GetSize()
        win.Position(pos, (0, sz[1]))

        win.Show(True)
Esempio n. 7
0
    def popUp(self):

        semNome = Tk()
        semNome.title("Erro 404 - Nome Não Encontrado")

        frm_width = semNome.winfo_rootx() - semNome.winfo_x()
        win_width = 500 + 2 * frm_width
        win_height = 120 + frm_width
        x = semNome.winfo_screenwidth() // 2 - win_width // 2
        y = semNome.winfo_screenheight() // 2 - win_height // 2

        semNome.geometry('500x120+{}+{}'.format(x, y))
        semNome['bg'] = '#353b48'

        popup.Popup(semNome)
        semNome.mainloop()
 def view_edited(self) -> None:
     """Opens edited image in default image viewer, if not possible, error popup displayed"""
     if self.gui.editor.edited_img:
         self.gui.editor.edited_img.show()
     else:
         pop.Popup("No Edited Image Found")
 def view_loaded(self) -> None:
     """Opens loaded image in default image viewer, if not possible, error popup displayed"""
     if self.gui.editor.loaded_img:
         self.gui.editor.loaded_img.show()
     else:
         pop.Popup("No Image Loaded")
Esempio n. 10
0
currValX = 0.
currValY = 0.
period = 1.  # sec
tRes = 5.  # pixels/sec
delT = period / tRes
plotWidth = 5.  # sec
nPts = plotWidth * tRes
slope = 1. / period  # Basic X/t Y/t slope

# Open figure
plt.close('all')
fig = plt.figure(figsize=(winXSizeInches, winYSizeInches))
fig.canvas.set_window_title('CliffordVec')
fig.text(.05, .9, "'Q' to quit", fontsize=18)
plt.show()
popup.Popup()


# Keypress 'q' to quit callback function
def press(event):
    #    sys.stdout.flush()
    if event.key == 'q':
        plt.close()


fig.canvas.mpl_connect('key_press_event', press)

xLight = initaxes.ScalarLight((.05, .55, .2, .2), "x")

yLight = initaxes.ScalarLight((.05, .1, .2, .2), 'y')
Esempio n. 11
0
m.add_tile_layer()
circles_fg = folium.map.FeatureGroup(
    name='hide/show cluster circles').add_to(m)

legend_html = '''
                <div style="position: fixed; 
                            bottom: 10px; left: 10px; width: 210px; height: 80px; 
                            border:2px solid grey; z-index:9999; font-size:14px;
                            ">&nbsp; Legend <br>
                              &nbsp; <i class="fa fa-map-marker fa-2x" style="color:green"></i> Cluster point (different colors)&nbsp; <br>
                              &nbsp; <i class="fa-rotate-0 fa fa-object-group  icon-white"></i> Multiple clusters in one point &nbsp;
                </div>
                '''
m.get_root().html.add_child(folium.Element(legend_html))

popup_builder = popup.Popup()
created_points = set()
point_count = 0
for counter, clusterId in enumerate(sorted(clusters.keys())):
    # skip points not in cluster
    if int(clusterId) == 0:
        continue
    # cut most of the dataset
    #if counter == 10: break

    points_in_cluster = len(clusters[clusterId]['points'])
    cluster_fg = folium.map.FeatureGroup(name='[{}] {} cluster'.format(
        points_in_cluster, str(clusterId))).add_to(m)
    clusters[clusterId]['feature_group'] = cluster_fg

    if points_in_cluster > 1 and not clusterId == '0':